Make WordPress Core

Changeset 60065


Ignore:
Timestamp:
03/21/2025 06:00:25 PM (4 months ago)
Author:
desrosj
Message:

Build/Test Tools: Re-add GitHub App.

Without this, workflow runs are not triggered by commits made by the workflow.

Follow up to [59983], [60052], [60059], [60063], [60064].

See #62221.

File:
1 edited

Legend:

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

    r60064 r60065  
    2525  # - Checks for the existence of an artifact.
    2626  # - Unzips the artifact.
     27  # - Generates a token for authenticating with the GitHub App.
    2728  # - Checks out the repository.
    2829  # - Applies the patch file.
     
    8485        run: unzip pr-built-file-changes.zip
    8586
     87      - name: Generate Installation Token
     88        id: generate_token
     89        if: ${{ steps.artifact-check.outputs.exists == 'true' }}
     90        env:
     91          GH_APP_ID: ${{ secrets.GH_PR_BUILT_FILES_APP_ID }}
     92          GH_APP_PRIVATE_KEY: ${{ secrets.GH_PR_BUILT_FILES_PRIVATE_KEY }}
     93        run: |
     94          echo "$GH_APP_PRIVATE_KEY" > private-key.pem
     95
     96          # Generate JWT
     97          JWT=$(python3 - <<EOF
     98          import jwt, time
     99          private_key = open("private-key.pem", "r").read()
     100          payload = {
     101              "iat": int(time.time()),
     102              "exp": int(time.time()) + 600,  # 10-minute expiration
     103              "iss": $GH_APP_ID
     104          }
     105          print(jwt.encode(payload, private_key, algorithm="RS256"))
     106          EOF
     107          )
     108
     109          # Get Installation ID
     110          INSTALLATION_ID=$(curl -s -X GET -H "Authorization: Bearer $JWT" \
     111            -H "Accept: application/vnd.github.v3+json" \
     112            https://api.github.com/app/installations | jq -r '.[0].id')
     113
     114          # Request Installation Access Token
     115          ACCESS_TOKEN=$(curl -s -X POST -H "Authorization: Bearer $JWT" \
     116            -H "Accept: application/vnd.github.v3+json" \
     117            "https://api.github.com/app/installations/$INSTALLATION_ID/access_tokens" | jq -r '.token')
     118
     119          echo "ACCESS_TOKEN=$ACCESS_TOKEN" >> "$GITHUB_ENV"
     120
     121          rm -f private-key.pem
     122
    86123      - name: Checkout repository
    87124        uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
     
    92129          path: 'pr-repo'
    93130          show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
     131          token: ${{ env.ACCESS_TOKEN }}
    94132
    95133      - name: Apply patch
     
    106144        if: ${{ steps.artifact-check.outputs.exists == 'true' }}
    107145        working-directory: 'pr-repo'
     146        env:
     147          GH_APP_ID: ${{ secrets.GH_PR_BUILT_FILES_APP_ID }}
    108148        run: |
    109           git config user.name "WordPress Build Script Bot[bot]"
    110           git config user.email wordpress@users.noreply.github.com
     149          git config user.name "wordpress-develop-pr-bot[bot]"
     150          git config user.email ${{ env.GH_APP_ID }}+wordpress-develop-pr-bot[bot]@users.noreply.github.com
    111151
    112152      - name: Stage changes
Note: See TracChangeset for help on using the changeset viewer.