Make WordPress Core

Changeset 62251


Ignore:
Timestamp:
04/21/2026 04:56:34 PM (2 weeks ago)
Author:
johnbillion
Message:

Build/Test Tools: Address some issues in GitHub Actions workflow files as reported by Zizmor.

This removes unnecessarily broad inheritance of secrets, replaces some GitHub Actions expressions with environment variables, removes git credential persistence, and adds documentation to the readme.

See #64227

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/commit-built-file-changes.yml

    r61663 r62251  
    132132          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
    133133          token: ${{ env.ACCESS_TOKEN }}
     134          persist-credentials: true
    134135
    135136      - name: Apply patch
    136137        if: ${{ steps.artifact-check.outputs.exists == 'true' }}
    137138        working-directory: 'pr-repo'
    138         run: git apply ${{ github.workspace }}/changes.diff
     139        run: git apply "$GITHUB_WORKSPACE/changes.diff"
    139140
    140141      - name: Display changes to versioned files
     
    150151        run: |
    151152          git config user.name "wordpress-develop-pr-bot[bot]"
    152           git config user.email ${{ env.GH_APP_ID }}+wordpress-develop-pr-bot[bot]@users.noreply.github.com
     153          git config user.email "${GH_APP_ID}+wordpress-develop-pr-bot[bot]@users.noreply.github.com"
    153154
    154155      - name: Stage changes
  • trunk/.github/workflows/install-testing.yml

    r62033 r62251  
    5050    permissions:
    5151      contents: read
    52     secrets: inherit
    5352    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    5453    with:
  • trunk/.github/workflows/local-docker-environment.yml

    r62095 r62251  
    8080    permissions:
    8181      contents: read
    82     secrets: inherit
    8382    if: ${{ github.repository == 'WordPress/wordpress-develop' }}
    8483    with:
  • trunk/.github/workflows/phpunit-tests.yml

    r61875 r62251  
    6767    permissions:
    6868      contents: read
    69     secrets: inherit
     69    secrets:
     70      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
     71      WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
    7072    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
    7173    strategy:
     
    144146    permissions:
    145147      contents: read
    146     secrets: inherit
     148    secrets:
     149      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
     150      WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
    147151    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
    148152    strategy:
     
    196200    permissions:
    197201      contents: read
    198     secrets: inherit
     202    secrets:
     203      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
     204      WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
    199205    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
    200206    strategy:
     
    239245    permissions:
    240246      contents: read
    241     secrets: inherit
     247    secrets:
     248      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
     249      WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
    242250    if: ${{ startsWith( github.repository, 'WordPress/' ) && ( github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' ) }}
    243251    strategy:
     
    268276    permissions:
    269277      contents: read
    270     secrets: inherit
     278    secrets:
     279      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
     280      WPT_REPORT_API_KEY: ${{ secrets.WPT_REPORT_API_KEY }}
    271281    if: ${{ ! startsWith( github.repository, 'WordPress/' ) && github.event_name == 'pull_request' }}
    272282    strategy:
  • trunk/.github/workflows/reusable-check-built-files.yml

    r62033 r62251  
    4141        with:
    4242          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
     43          persist-credentials: false
    4344
    4445      - name: Set up Node.js
  • trunk/.github/workflows/reusable-cleanup-pull-requests.yml

    r61209 r62251  
    2020  # - Parse the SVN revision from the commit message.
    2121  # - Searches for pull requests referencing any fixed tickets.
    22   # - Leaves a comment on each PR before closing.
     22# - Comments on pull requests referencing any fixed tickets before closing.
    2323  close-prs:
    2424    name: Find and close PRs
     
    4444          echo "svn_revision_number=$(echo "$COMMIT_MESSAGE" | sed -n 's/.*git-svn-id: https:\/\/develop.svn.wordpress.org\/[^@]*@\([0-9]*\) .*/\1/p')" >> "$GITHUB_OUTPUT"
    4545
    46       - name: Find pull requests
    47         id: linked-prs
     46      - name: Find, comment on, and close pull requests
    4847        if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }}
    4948        uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
     49        env:
     50          FIXED_LIST: ${{ steps.trac-tickets.outputs.fixed_list }}
     51          SVN_REVISION_NUMBER: ${{ steps.git-svn-id.outputs.svn_revision_number }}
    5052        with:
    5153          script: |
    52             const fixedList = "${{ steps.trac-tickets.outputs.fixed_list }}".split(' ').filter(Boolean);
     54            const fixedList = process.env.FIXED_LIST.split(' ').filter(Boolean);
     55            const svnRevisionNumber = process.env.SVN_REVISION_NUMBER;
     56            const githubSha = process.env.GITHUB_SHA;
    5357            let prNumbers = [];
    5458
     
    8791            }
    8892
    89             return prNumbers;
    90 
    91       - name: Comment and close pull requests
    92         if: ${{ steps.trac-tickets.outputs.fixed_list != '' && steps.git-svn-id.outputs.svn_revision_number != '' }}
    93         uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
    94         with:
    95           script: |
    96             const prNumbers = ${{ steps.linked-prs.outputs.result }};
    97 
    9893            const commentBody = `A commit was made that fixes the Trac ticket referenced in the description of this pull request.
    9994
    100             SVN changeset: [${{ steps.git-svn-id.outputs.svn_revision_number }}](https://core.trac.wordpress.org/changeset/${{ steps.git-svn-id.outputs.svn_revision_number }})
    101             GitHub commit: https://github.com/WordPress/wordpress-develop/commit/${{ github.sha }}
     95            SVN changeset: [${svnRevisionNumber}](https://core.trac.wordpress.org/changeset/${svnRevisionNumber})
     96            GitHub commit: https://github.com/WordPress/wordpress-develop/commit/${githubSha}
    10297
    10398            This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.`;
  • trunk/README.md

    r61203 r62251  
    9898```
    9999
     100#### To lint the workflow files
     101
     102GitHub Actions workflows operate in a privileged software supply chain environment, therefore all workflow files must adhere to a high degree of quality and security standards.
     103
     104All YAML workflow files within the `.github/workflows` directory are statically scanned when modified using [Actionlint](https://github.com/rhysd/actionlint) and [Zizmor](https://github.com/zizmorcore/zizmor). It's recommended that you install both of these tools locally using a package manager to run prior to submitting changes to workflow files.
     105
     106- [Actionlint installations instructions](https://github.com/rhysd/actionlint/blob/main/docs/install.md)
     107- [Zizmor installation instructions](https://docs.zizmor.sh/installation/)
     108
     109To run Actionlint:
     110
     111```
     112actionlint
     113```
     114
     115To run Zizmor for all workflow files (note the trailing period):
     116
     117```
     118zizmor .
     119```
     120
     121**Note:** A workflow run failure will not occur when issues are detected by Zizmor. Instead, the generated report is submitted to GitHub Code Scanning and surfaced through a status check. Some locally reported issues may be ignored based on the repository's configured Code Scanning settings.
     122
    100123#### Generating a code coverage report
    101124PHP code coverage reports are [generated daily](https://github.com/WordPress/wordpress-develop/actions/workflows/test-coverage.yml) and [submitted to Codecov.io](https://app.codecov.io/gh/WordPress/wordpress-develop).
Note: See TracChangeset for help on using the changeset viewer.