From af8587eabf83fa38fad153bfe25f714524542c07 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Mon, 4 Aug 2025 15:51:42 +0100 Subject: [PATCH] [ty] Link directly to typing conformance test suite when commenting the diff (#19736) --- .github/workflows/typing_conformance.yaml | 10 +++++++++- .../workflows/typing_conformance_comment.yaml | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typing_conformance.yaml b/.github/workflows/typing_conformance.yaml index f5a24e2375..def7469228 100644 --- a/.github/workflows/typing_conformance.yaml +++ b/.github/workflows/typing_conformance.yaml @@ -24,6 +24,7 @@ env: CARGO_TERM_COLOR: always RUSTUP_MAX_RETRIES: 10 RUST_BACKTRACE: 1 + CONFORMANCE_SUITE_COMMIT: d4f39b27a4a47aac8b6d4019e1b0b5b3156fabdc jobs: typing_conformance: @@ -40,7 +41,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: repository: python/typing - ref: d4f39b27a4a47aac8b6d4019e1b0b5b3156fabdc + ref: ${{ env.CONFORMANCE_SUITE_COMMIT }} path: typing persist-credentials: false @@ -95,6 +96,7 @@ jobs: fi echo ${{ github.event.number }} > pr-number + echo "${CONFORMANCE_SUITE_COMMIT}" > conformance-suite-commit - name: Upload diff uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 @@ -107,3 +109,9 @@ jobs: with: name: pr-number path: pr-number + + - name: Upload conformance suite commit + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: conformance-suite-commit + path: conformance-suite-commit diff --git a/.github/workflows/typing_conformance_comment.yaml b/.github/workflows/typing_conformance_comment.yaml index ce069744f1..359fb387e9 100644 --- a/.github/workflows/typing_conformance_comment.yaml +++ b/.github/workflows/typing_conformance_comment.yaml @@ -32,6 +32,22 @@ jobs: echo "pr-number=$(> "$GITHUB_OUTPUT" fi + - uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8 + name: Download typing conformance suite commit + with: + name: conformance-suite-commit + run_id: ${{ github.event.workflow_run.id || github.event.inputs.workflow_run_id }} + if_no_artifact_found: ignore + allow_forks: true + + - name: Parse conformance suite commit + id: conformance-suite-commit + run: | + if [[ -f conformance-suite-commit ]] + then + echo "CONFORMANCE_SUITE_COMMIT=$(> "$GITHUB_OUTPUT" + fi + - uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8 name: "Download typing_conformance results" id: download-typing_conformance_diff @@ -61,7 +77,7 @@ jobs: # subsequent runs echo '' >> comment.txt - echo '## Diagnostic diff on typing conformance tests' >> comment.txt + echo "## Diagnostic diff on [typing conformance tests](https://github.com/python/typing/tree/${CONFORMANCE_SUITE_COMMIT}/conformance)" >> comment.txt if [ -s "pr/typing_conformance_diagnostics_diff/typing_conformance_diagnostics.diff" ]; then echo '
' >> comment.txt echo 'Changes were detected when running ty on typing conformance tests' >> comment.txt