diff --git a/.github/workflows/update-gem-version-artifacts.yaml b/.github/workflows/update-gem-version-artifacts.yaml index 5bed4d00..faa34b48 100644 --- a/.github/workflows/update-gem-version-artifacts.yaml +++ b/.github/workflows/update-gem-version-artifacts.yaml @@ -23,10 +23,9 @@ jobs: - name: Checkout Git Repo uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: - # We still need to check out using GITHUB_TOKEN so we can make local changes, - # but the push will use the personal access token. ref: ${{ github.head_ref }} - token: ${{ secrets.GITHUB_TOKEN }} + # Use the PAT for checkout to ensure proper permissions + token: ${{ secrets.PAT_FOR_PUSHING_AND_TRIGGERING_CI }} - name: Set up Ruby uses: ruby/setup-ruby@2a18b06812b0e15bb916e1df298d3e740422c47e # v1.203.0 @@ -48,8 +47,7 @@ jobs: git add rbs_collection.lock.yaml Gemfile Gemfile.lock *.gemspec git commit -m "Update gem version artifacts." - # Push with PAT so it triggers "on: pull_request" or "on: push" events - # Replace "block" with your actual GitHub org/user, if different. - git push "https://github-actions[bot]:${{ secrets.PAT_FOR_PUSHING_AND_TRIGGERING_CI }}@github.com/block/elasticgraph.git" HEAD:${{ github.head_ref }} + # Push using the PAT + git remote set-url origin "https://x-access-token:${{ secrets.PAT_FOR_PUSHING_AND_TRIGGERING_CI }}@github.com/${{ github.repository }}.git" + git push origin HEAD:${{ github.head_ref }} fi -