From a8e46925ac844b53fe9d9a1e525e9ccd3d2dcdc8 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Tue, 24 Nov 2026 12:09:28 +0000 Subject: [PATCH] ci: Mint tokens from the tooling App promote passes the tooling App on to the shared workflow, which mints a token from it instead of using GH_PAT. sync mints its own, scoped to this repository, to open its PR. And tooling-app checks that the key matches its fingerprint, like in x. Signed-off-by: Justin Chadwell --- .github/workflows/promote.yaml | 4 +++- .github/workflows/sync.yaml | 12 +++++++++++- .github/workflows/tooling-app.yaml | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/tooling-app.yaml diff --git a/.github/workflows/promote.yaml b/.github/workflows/promote.yaml index 42e7bb0..99668b5 100644 --- a/.github/workflows/promote.yaml +++ b/.github/workflows/promote.yaml @@ -11,5 +11,7 @@ permissions: jobs: promote: uses: unikraft-cloud/x/.github/workflows/promote.yaml@prod-staging + with: + gh_client_id: ${{ vars.TOOLING_APP_CLIENT_ID }} secrets: - gh_pat: ${{ secrets.GH_PAT }} + gh_private_key: ${{ secrets.TOOLING_APP_PRIVATE_KEY }} diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index a533e2d..d6ae497 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -21,6 +21,16 @@ jobs: sync: runs-on: ubuntu-latest steps: + - name: Mint a token of the GitHub App + id: app-token + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.TOOLING_APP_CLIENT_ID }} + private-key: ${{ secrets.TOOLING_APP_PRIVATE_KEY }} + repositories: ${{ github.event.repository.name }} + permission-contents: write + permission-pull-requests: write + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 with: ref: ${{ inputs.channel }} @@ -57,7 +67,7 @@ jobs: - name: Create pull request uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 with: - token: ${{ secrets.GH_PAT }} + token: ${{ steps.app-token.outputs.token }} base: ${{ inputs.channel }} commit-message: "chore: Update Python SDK from OpenAPI spec" title: "chore: Update Python SDK from OpenAPI spec" diff --git a/.github/workflows/tooling-app.yaml b/.github/workflows/tooling-app.yaml new file mode 100644 index 0000000..02434ca --- /dev/null +++ b/.github/workflows/tooling-app.yaml @@ -0,0 +1,27 @@ +name: tooling-app + +on: + schedule: + # Changing a secret doesn't trigger a run, so catch a swapped key here. + - cron: '0 9 * * 1' + workflow_dispatch: + push: + branches: [prod-staging] + pull_request: + branches: [prod-staging] + paths: + - .github/workflows/tooling-app.yaml + +permissions: + contents: read + +jobs: + # The fingerprint names the key of this repository on the tooling App's page. + app-key: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: unikraft-cloud/x/.github/actions/check-key-fingerprint@prod-staging + with: + private-key: ${{ secrets.TOOLING_APP_PRIVATE_KEY }} + fingerprint: ${{ vars.TOOLING_APP_PRIVATE_KEY_FINGERPRINT }}