From a959c2596f8a1d1ef9f321b8b227a399e86409e2 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Wed, 8 Jul 2026 11:29:51 -0400 Subject: [PATCH 1/3] Removed PR number artifact from coverage comment workflows. Retrieving the PR number directly instead of from an artifact prevents it from being spoofed. Thanks Sarah Boyce for the review. --- .github/workflows/coverage_comment.yml | 30 ++++++++++++++------------ .github/workflows/coverage_tests.yml | 8 +------ zizmor.yml | 1 - 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.github/workflows/coverage_comment.yml b/.github/workflows/coverage_comment.yml index c826b8a7257b..da94d0d81f8c 100644 --- a/.github/workflows/coverage_comment.yml +++ b/.github/workflows/coverage_comment.yml @@ -1,7 +1,10 @@ name: Coverage Comment on: - workflow_run: + # The so-called dangerous workflow_run trigger is necessary for letting forks + # gain workflow-scoped pull-requests: write permission. The only + # user-controlled content is the content of diff-cover-report.md. + workflow_run: # zizmor: ignore[dangerous-triggers] workflows: ["Coverage Tests"] types: - completed @@ -27,15 +30,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} run-id: ${{ github.event.workflow_run.id }} - - name: Read PR number - id: pr - run: | - pr_number=$(cat pr_number.txt) - echo "number=$pr_number" >> $GITHUB_OUTPUT - - name: Post/update PR comment - env: - PR_NUMBER: ${{ steps.pr.outputs.number }} uses: actions/github-script@v9 with: script: | @@ -54,16 +49,23 @@ jobs: '**Note:** Missing lines are warnings only. Some database-specific lines may not be measured. [More information](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#code-coverage-on-pull-requests)' ); - const prNumber = parseInt(process.env.PR_NUMBER); - if (isNaN(prNumber)) { - core.setFailed('PR number is not available or invalid.'); + const headSha = context.payload.workflow_run.head_sha; + const { data: prs } = + await github.rest.repos.listPullRequestsAssociatedWithCommit({ + owner: context.repo.owner, + repo: context.repo.repo, + commit_sha: headSha, + }); + const pr = prs.find((p) => p.head.sha === headSha); + if (!pr) { + core.setFailed(`No PR found for commit ${headSha}.`); return; } const { data: comments } = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: prNumber, + issue_number: pr.number, }); for (const c of comments) { @@ -79,6 +81,6 @@ jobs: await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: prNumber, + issue_number: pr.number, body: commentBody, }); diff --git a/.github/workflows/coverage_tests.yml b/.github/workflows/coverage_tests.yml index 4ac6751e5da8..0020694597f3 100644 --- a/.github/workflows/coverage_tests.yml +++ b/.github/workflows/coverage_tests.yml @@ -87,16 +87,10 @@ jobs: echo "No coverage data available." > diff-cover-report.md fi - - name: Save PR number - if: success() - run: echo "${{ github.event.pull_request.number }}" > pr_number.txt - - name: Upload artifacts if: success() uses: actions/upload-artifact@v7 with: name: coverage-artifacts - path: | - diff-cover-report.md - pr_number.txt + path: diff-cover-report.md retention-days: 1 diff --git a/zizmor.yml b/zizmor.yml index 40cc34254e9b..0eea96ed7da9 100644 --- a/zizmor.yml +++ b/zizmor.yml @@ -3,7 +3,6 @@ rules: # Before ignoring a file, assume all inputs are malicious, assign explicit # minimal permissions, and do not use actions/checkout. ignore: - - coverage_comment.yml - labels.yml - new_contributor_pr.yml - check_pr_quality.yml From e1feeee45ea8bcd4325554c9b94fcd75fcd8dbdc Mon Sep 17 00:00:00 2001 From: maheen8q Date: Sun, 5 Jul 2026 00:22:53 +0500 Subject: [PATCH 2/3] Fixed #37194 -- Removed redundant choice widget documentation. The removed section primarily provided usage examples and recommendations rather than documenting the widget API. The interaction between a choice field and its widget is already documented in the Select.choices reference. --- docs/ref/forms/widgets.txt | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 25f6079a0aeb..edb6d8c783af 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -79,39 +79,6 @@ widget on the field. In the following example, the See the :ref:`built-in widgets` for more information about which widgets are available and which arguments they accept. -Widgets inheriting from the ``Select`` widget -============================================= - -Widgets inheriting from the :class:`Select` widget deal with choices. They -present the user with a list of options to choose from. The different widgets -present this choice differently; the :class:`Select` widget itself uses a -``