diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml index 4884003..24202b4 100644 --- a/.github/actionlint.yaml +++ b/.github/actionlint.yaml @@ -11,3 +11,10 @@ paths: # knows v3's inputs and the lint passes without them. - 'missing input "app-id" which is required by action "actions/create-github-app-token@v3"' - 'input "client-id" is not defined in action "actions/create-github-app-token@v3"' + .github/workflows/sync-upstream.yml: + ignore: + # Same false positive as release-please.yml above: actionlint's bundled metadata predates + # actions/create-github-app-token v3's `client-id` input. Added 2026-11-02 with the Refresh Bot + # token for the sync PR. Delete both entries when an actionlint release knows v3's inputs. + - 'missing input "app-id" which is required by action "actions/create-github-app-token@v3"' + - 'input "client-id" is not defined in action "actions/create-github-app-token@v3"' diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 2248905..d9cb6ce 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -10,7 +10,11 @@ # release. Packagist reads the tag and lists the new version. # # Required: -# GITHUB_TOKEN (automatic) for PR creation. +# Refresh Bot (REFRESH_APP_CLIENT_ID / REFRESH_APP_PRIVATE_KEY, org level; a +# private repo needs repository copies) for the push and the PR. The +# organisation does not let GITHUB_TOKEN create pull requests, so a sync PR +# opened with it fails with "GitHub Actions is not permitted to create or +# approve pull requests". name: Sync upstream @@ -64,10 +68,21 @@ jobs: git config user.name "ichava-sync-bot" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + # A per-run Refresh Bot token, so the PR can be opened at all (GITHUB_TOKEN + # may not create pull requests here) and its checks start like any other. + - name: Mint the Refresh Bot token + id: app + uses: actions/create-github-app-token@v3 + with: + client-id: ${{ vars.REFRESH_APP_CLIENT_ID }} + private-key: ${{ secrets.REFRESH_APP_PRIVATE_KEY }} + permission-contents: write + permission-pull-requests: write + - name: Authenticate gh for PR creation run: gh auth setup-git env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app.outputs.token }} # Build from the toolkit checkout instead of pulling ghcr.io — the # GHCR package is private and other repos' GITHUB_TOKENs cannot pull @@ -77,7 +92,7 @@ jobs: - name: Run icon-sets-sync via Docker env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app.outputs.token }} PACK_SLUG: ${{ github.event.repository.name }} run: | # An array, not a string: $FLAGS unquoted relies on word-splitting to diff --git a/CHANGELOG.md b/CHANGELOG.md index a145f8a..88e0a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to `ichava/icon-sets-flag` follow [Keep a Changelog](https:/ ## [Unreleased] +### Fixed + +- The weekly upstream sync opens its pull request with a Refresh Bot token. GitHub Actions' own + token is not allowed to create pull requests in this organisation, so the sync failed at its last + step after refreshing the assets. + ## [0.1.0] - TBD First release of `ichava/icon-sets-flag`. The repository is published as a single commit; the 0.1.x tags cut between 2026-10-23 and 2026-10-26 (v0.1.0 to v0.1.1) are folded into this release, and their notes are kept below under *Archived history*.