diff --git a/.github/actions/get-commit-msg/action.yml b/.github/actions/get-commit-msg/action.yml index 6aa41c8ea5..6b160d4890 100644 --- a/.github/actions/get-commit-msg/action.yml +++ b/.github/actions/get-commit-msg/action.yml @@ -1,3 +1,5 @@ +# This action retrieves the latest commit message from a push or pull_request event +# and makes it available as an output variable named 'msg'. name: 'Get commit message' outputs: msg: @@ -8,6 +10,8 @@ runs: - name: Find commit message (on push) if: github.event_name == 'push' shell: bash + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: | AUTHOR_NAME="${{ github.event.head_commit.author.name }}" AUTHOR_EMAIL="${{ github.event.head_commit.author.email }}" @@ -16,15 +20,12 @@ runs: echo "Author: ${AUTHOR_NAME}<${AUTHOR_EMAIL}>" >> /tmp/commit_msg.txt echo "Date: ${TSTAMP}" >> /tmp/commit_msg.txt echo "" >> /tmp/commit_msg.txt - echo "${{ github.event.head_commit.message }}" >> /tmp/commit_msg.txt + echo "$COMMIT_MESSAGE" >> /tmp/commit_msg.txt - name: Find commit message (PR) shell: bash id: checkout_code if: github.event_name == 'pull_request' run: | - echo "+++++ head commit message +++++" - echo "$(git log -1 --no-merges)" - echo "+++++++++++++++++++++++++++++++" echo "hash=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" git checkout ${{ github.event.pull_request.head.sha }} echo "$(git log -1 --no-merges)" >> /tmp/commit_msg.txt diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index 1d9b8df741..bb78d8e0d8 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -107,8 +107,10 @@ jobs: - id: get_commit_msg uses: ./.github/actions/get-commit-msg - name: Check for manual edits to /docs + env: + COMMIT_MESSAGE: ${{ steps.get_commit_msg.outputs.msg }} run: | - COMMIT_ID=$(echo "${{ steps.get_commit_msg.outputs.msg }}" | head -n 1 | sed "s/commit //g") + COMMIT_ID=$(echo "${COMMIT_MESSAGE}" | head -n 1 | sed "s/commit //g") bash docs_src/build/presubmit_check.sh ${COMMIT_ID} test-renderdiff: @@ -121,7 +123,7 @@ jobs: - uses: ./.github/actions/mac-prereq - uses: ./.github/actions/get-gltf-assets - uses: ./.github/actions/get-mesa - - uses: ./.github/actions/get-vulkan-sdk + - uses: ./.github/actions/get-vulkan-sdk - id: get_commit_msg uses: ./.github/actions/get-commit-msg - name: Prerequisites @@ -132,12 +134,14 @@ jobs: shell: bash - name: Render and compare id: render_compare + env: + COMMIT_MESSAGE: ${{ steps.get_commit_msg.outputs.msg }} run: | ls ./gltf/Models TEST_DIR=test/renderdiff source ${TEST_DIR}/src/preamble.sh start_ - GOLDEN_BRANCH=$(echo "${{ steps.get_commit_msg.outputs.msg }}" | python3 ${TEST_DIR}/src/commit_msg.py) + GOLDEN_BRANCH=$(echo "${COMMIT_MESSAGE}" | python3 ${TEST_DIR}/src/commit_msg.py) bash ${TEST_DIR}/generate.sh && \ python3 ${TEST_DIR}/src/golden_manager.py \ --branch=${GOLDEN_BRANCH} \ diff --git a/docs_src/build/checks.py b/docs_src/build/checks.py index 4b8212b7c2..714a63e0cf 100644 --- a/docs_src/build/checks.py +++ b/docs_src/build/checks.py @@ -77,11 +77,11 @@ def check_has_source_edits(commit_hash, printing=True): # Returns true in a given TAG is found in the commit msg def commit_msg_has_tag(commit_hash, tag, printing=True): - res, ret = execute(f'git log --pretty=%B {commit_hash}', cwd=ROOT_DIR) + res, ret = execute(f'git log -n1 --pretty=%B {commit_hash}', cwd=ROOT_DIR) for l in ret.split('\n'): if tag == l.strip(): if printing: - print(f'Found tag={tag} in commit message') + print(f'Found tag={tag} in commit={commit_hash}') return True return False