From 9e7ed7edc2f557c65c281720039004f55e8a962d Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 16 Nov 2026 11:10:14 -0900 Subject: [PATCH 1/2] Replace GitHub bot token For the coder/code-server-aur update, generate a token using our GitHub app instead. For the others that open PRs against coder/code-server, just use GITHUB_TOKEN since that apparently works. I also moved the env block to the step that executes the `gh` cli rather than setting it job-level. --- .github/workflows/publish.yaml | 22 +++++++++++++++++++--- .github/workflows/update.yaml | 5 ++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index dc58cf2f3ef7..3f4d1745e6e6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -56,9 +56,9 @@ jobs: aur: runs-on: ubuntu-latest + environment: release timeout-minutes: 10 env: - GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} TAG: ${{ inputs.version || github.ref_name }} steps: @@ -66,11 +66,22 @@ jobs: run: | echo "VERSION=${TAG#v}" >> $GITHUB_ENV + - name: Generate coder-automations app token + id: app_token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + app-id: ${{ secrets.CODER_AUTOMATION_APP_ID }} + private-key: ${{ secrets.CODER_AUTOMATION_APP_PRIVATE_KEY }} + owner: coder + repositories: code-server-aur + permission-contents: write + permission-pull-requests: write + - name: Checkout code-server-aur repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: repository: "cdrci/code-server-aur" - token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + token: ${{ steps.app_token.outputs.token }} ref: "master" - name: Configure git @@ -93,6 +104,8 @@ jobs: srcinfo: true - name: Open PR + env: + GH_TOKEN: ${{ steps.app_token.outputs.token }} run: | git checkout -b update-version-${{ env.VERSION }} git add . @@ -156,8 +169,9 @@ jobs: repo: runs-on: ubuntu-latest + permissions: + pull-requests: write env: - GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} TAG: ${{ inputs.version || github.ref_name }} needs: docker @@ -171,6 +185,8 @@ jobs: - run: ./ci/build/update-repo.sh - name: Open PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config --global user.name cdrci git config --global user.email opensource@coder.com diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index b54826c79f70..05105a7f4f53 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -12,9 +12,10 @@ on: jobs: update: runs-on: ubuntu-latest + permissions: + pull-requests: write env: TAG: ${{ inputs.version }} - GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} steps: - name: Fetch latest tag @@ -58,6 +59,8 @@ jobs: - name: Open PR if: steps.check.outputs.done == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config --global user.name cdrci git config --global user.email opensource@coder.com From 1e98dec1cf00e17d5d78d460110ce0876729cd89 Mon Sep 17 00:00:00 2001 From: Asher Date: Mon, 16 Nov 2026 11:46:41 -0900 Subject: [PATCH 2/2] I think it needs contents: write as well --- .github/workflows/publish.yaml | 3 ++- .github/workflows/update.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 3f4d1745e6e6..8857977a7edc 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -170,7 +170,8 @@ jobs: repo: runs-on: ubuntu-latest permissions: - pull-requests: write + contents: write # To push the branch. + pull-requests: write # To open the PR. env: TAG: ${{ inputs.version || github.ref_name }} needs: docker diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml index 05105a7f4f53..7d2a6a950837 100644 --- a/.github/workflows/update.yaml +++ b/.github/workflows/update.yaml @@ -13,7 +13,8 @@ jobs: update: runs-on: ubuntu-latest permissions: - pull-requests: write + contents: write # To push the branch. + pull-requests: write # To open the PR. env: TAG: ${{ inputs.version }}