diff --git a/.github/scripts/warnings_report.py b/.github/scripts/warnings_report.py index 31c7440..4321dbd 100644 --- a/.github/scripts/warnings_report.py +++ b/.github/scripts/warnings_report.py @@ -271,7 +271,7 @@ class Report: def footer(self, full): parts = [] if self.sha: - parts.append(f"Commit {self.sha[:10]}") + parts.append(f"Built from commit {self.sha[:10]}") if self.run_url and not full: parts.append(f"[Full report and build logs]({self.run_url})") parts.append("Deduplicated across translation units and builds. " @@ -345,7 +345,7 @@ def main(): parser.add_argument("--logs-dir", required=True, help="Directory with one subdirectory per build log") parser.add_argument("--changed-files", help="File with one changed path (relative) per line") parser.add_argument("--repo", help="owner/name, for links to source lines") - parser.add_argument("--sha", help="Commit SHA, for links to source lines") + parser.add_argument("--sha", help="SHA of the commit that was built, for links to source lines") parser.add_argument("--run-url", help="URL of the workflow run") parser.add_argument("--comment", default="-", help="Output file for the PR comment (default: stdout)") parser.add_argument("--full", help="Output file for the full report (all warnings)") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ed2364..97a567e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,14 +63,15 @@ jobs: - name: Generate report env: - HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + # The commit that was built (for PRs, the merge of the PR into the base branch). + SOURCE_SHA: ${{ github.sha }} run: | mkdir -p logs changed=() if [ -f changed-files.txt ]; then changed=(--changed-files changed-files.txt); fi mkdir -p warnings-report python3 .github/scripts/warnings_report.py --logs-dir logs "${changed[@]}" \ - --repo "$GITHUB_REPOSITORY" --sha "$HEAD_SHA" \ + --repo "$GITHUB_REPOSITORY" --sha "$SOURCE_SHA" \ --run-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" \ --comment report.md \ --full warnings-report/warnings-report.md \