From 492c28f5bbbf70915f57a1246c63acfee954fb7c Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Fri, 6 Nov 2026 09:50:58 +0000 Subject: [PATCH] .github: run vouch as the headscale-bot App GITHUB_TOKEN PRs wait for CI approval and cannot merge past main's rules; the App is the ruleset bypass actor. Sync checks out main, so a dispatch on another branch cannot squash that branch into main. --- .github/workflows/vouch-manage-by-issue.yml | 19 +++++++++++++++---- .github/workflows/vouch-sync-codeowners.yml | 20 +++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/vouch-manage-by-issue.yml b/.github/workflows/vouch-manage-by-issue.yml index 7decc7ca9..54e1dfe0c 100644 --- a/.github/workflows/vouch-manage-by-issue.yml +++ b/.github/workflows/vouch-manage-by-issue.yml @@ -5,9 +5,7 @@ on: types: [created] permissions: - contents: write - issues: write - pull-requests: write + contents: read concurrency: group: vouch-manage @@ -17,7 +15,20 @@ jobs: manage: runs-on: ubuntu-latest steps: + # The bot App's token, not GITHUB_TOKEN: the App is the ruleset bypass + # actor that lets merge-immediately land without review or checks. + - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + id: app + with: + client-id: ${{ vars.HEADSCALE_BOT_CLIENT_ID }} + private-key: ${{ secrets.HEADSCALE_BOT_PRIVATE_KEY }} + permission-contents: write + permission-issues: write + permission-pull-requests: write + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + token: ${{ steps.app.outputs.token }} - uses: mitchellh/vouch/action/manage-by-issue@d66fa29a64600490892131ad87597c30c91fcac4 # v1.5.0 with: @@ -30,4 +41,4 @@ jobs: pull-request: "true" merge-immediately: "true" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.app.outputs.token }} diff --git a/.github/workflows/vouch-sync-codeowners.yml b/.github/workflows/vouch-sync-codeowners.yml index 96b7e0f87..a1ad5f456 100644 --- a/.github/workflows/vouch-sync-codeowners.yml +++ b/.github/workflows/vouch-sync-codeowners.yml @@ -6,8 +6,7 @@ on: workflow_dispatch: permissions: - contents: write - pull-requests: write + contents: read concurrency: group: vouch-manage @@ -17,7 +16,22 @@ jobs: sync: runs-on: ubuntu-latest steps: + # The bot App's token, not GITHUB_TOKEN: the App is the ruleset bypass + # actor that lets merge-immediately land without review or checks. + - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + id: app + with: + client-id: ${{ vars.HEADSCALE_BOT_CLIENT_ID }} + private-key: ${{ secrets.HEADSCALE_BOT_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + # vouch branches off the checkout and squash-merges into main through + # the App's bypass, so a dispatch on any other branch would land it. + ref: ${{ github.event.repository.default_branch }} + token: ${{ steps.app.outputs.token }} - uses: mitchellh/vouch/action/sync-codeowners@d66fa29a64600490892131ad87597c30c91fcac4 # v1.5.0 with: @@ -25,4 +39,4 @@ jobs: pull-request: "true" merge-immediately: "true" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.app.outputs.token }}