DBZ#1054 Update QOSDK to 7.7.0 #351
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Commit message format check | |
| on: | |
| # ATTENTION: See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | |
| # re security implications of using this trigger; in particular, no code from PR branches must | |
| # be executed in any flows triggered by it | |
| pull_request_target: | |
| branches: | |
| - main | |
| - 1.* | |
| - 2.* | |
| - 3.* | |
| - 4.* | |
| jobs: | |
| build: | |
| name: Commit message | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Commit messages in format debezium/dbz#xxx | |
| id: check | |
| env: | |
| pull_request_number: ${{ github.event.pull_request.number }} | |
| github_repository: ${{ github.repository }} | |
| run: | | |
| echo "PREFIX_COMMITS=false" >> $GITHUB_OUTPUT | |
| make_api_call_with_retries() { | |
| local URL="$1" | |
| local MAX_RETRIES="${2:-3}" | |
| local DELAY="${3:-2}" | |
| local ATTEMPT=1 | |
| if [[ -z "$URL" ]]; then | |
| echo "::error:: No URL provided to call_api_with_retries." >&2 | |
| return 1 | |
| fi | |
| while [ $ATTEMPT -le $MAX_RETRIES ]; do | |
| RESPONSE=$(curl --silent -w "%{http_code}" -X "GET" $URL) | |
| HTTP_CODE="${RESPONSE: -3}" | |
| BODY="${RESPONSE:: -3}" | |
| if [ "$HTTP_CODE" -eq 200 ]; then | |
| echo "$BODY" | |
| return 0 | |
| else | |
| sleep "$DELAY" | |
| DELAY=$((DELAY * 2)) | |
| fi | |
| ATTEMPT=$((ATTEMPT + 1)) | |
| done | |
| echo "::error:: No luck getting a successful response after $MAX_RETRIES retries." >&2 | |
| return 1 | |
| } | |
| if ! RESPONSE=$(make_api_call_with_retries "https://api.github.com/repos/$github_repository/pulls/$pull_request_number/commits"); then | |
| echo "::error:: No luck getting the commit messages." | |
| exit 1 | |
| fi | |
| MESSAGE=$(echo "$RESPONSE" | jq -r '.[].commit.message // empty') | |
| if [[ "$MESSAGE" == "API rate limit exceeded"* ]]; then | |
| echo "::error:: Github API rate limit exceeded. Skipping commit message check." | |
| exit 1 | |
| fi | |
| NON_PREFIX_COMMITS="" | |
| echo "$RESPONSE" | jq -r '.[] | .commit.message | split("\n")[0]' > COMMIT_MSGS.txt | |
| while IFS= read -r line; | |
| do | |
| echo "-> checking: $line" | |
| if [[ ! $line =~ (^debezium/dbz#[[:digit:]]+)|(DBZ-[[:digit:]]+)|(\[release\])|(\[jenkins-jobs\])|(\[docs\])|(\[maven-release-plugin\])|(\[ci\]) ]]; then | |
| NON_PREFIX_COMMITS="${NON_PREFIX_COMMITS} -> ${line}\n" | |
| fi | |
| done < COMMIT_MSGS.txt | |
| if [[ -n $NON_PREFIX_COMMITS ]]; then | |
| echo "========================================================================" | |
| echo " COMMIT MESSAGES WITH MISSING \"debezium/dbz\" PREFIX" | |
| echo "========================================================================" | |
| echo -e "$NON_PREFIX_COMMITS" | |
| echo "PREFIX_COMMITS=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "All commit messages are properly prefixed." | |
| echo "PREFIX_COMMITS=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create Comment | |
| if: ${{ steps.check.outputs.PREFIX_COMMITS == 'false' }} | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| Hi @${{ github.event.pull_request.user.login }}, thanks for your contribution. Please prefix the commit message(s) with the [debezium/dbz#xxx GitHub issue key](https://github.com/debezium/debezium/blob/main/CONTRIBUTING.md#making-changes). | |
| - name: Check failure | |
| if: ${{ steps.check.outputs.PREFIX_COMMITS == 'false' }} | |
| uses: actions/github-script@v8 | |
| continue-on-error: false | |
| with: | |
| script: | | |
| throw new Error('Commit has no debezium/dbz#xxx prefix') |