chore: keep GitHub App token action on v3 (#177) #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2026 LibreCode coop and contributors | |
| # SPDX-License-Identifier: AGPL-3.0-or-later | |
| name: Publish workflow catalog | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'workflow-templates/**' | |
| - 'workflow-catalog.json' | |
| - 'scripts/sync_catalog.py' | |
| - '.github/workflows/catalog-publish.yml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| name: Publish organization workflow catalog | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Validate GitHub App configuration | |
| env: | |
| WORKFLOW_APP_PRIVATE_KEY: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} | |
| run: | | |
| if [ -z "$WORKFLOW_APP_PRIVATE_KEY" ]; then | |
| echo "::error::LIBRECODE_WORKFLOW_APP_PRIVATE_KEY is not configured." | |
| exit 1 | |
| fi | |
| - name: Resolve GitHub App client id | |
| id: app-identity | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| WORKFLOW_APP_SLUG: librecode-workflow-automation | |
| run: | | |
| set -euo pipefail | |
| client_id="$(gh api "/apps/${WORKFLOW_APP_SLUG}" --jq .client_id)" | |
| if [ -z "$client_id" ]; then | |
| echo "::error::GitHub App metadata did not contain a client_id." | |
| exit 1 | |
| fi | |
| echo "client-id=$client_id" >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| client-id: ${{ steps.app-identity.outputs.client-id }} | |
| private-key: ${{ secrets.LIBRECODE_WORKFLOW_APP_PRIVATE_KEY }} | |
| owner: LibreCodeCoop | |
| repositories: .github | |
| permission-contents: write | |
| permission-pull-requests: write | |
| permission-workflows: write | |
| - name: Checkout workflow source | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Checkout organization catalog | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: LibreCodeCoop/.github | |
| token: ${{ steps.app-token.outputs.token }} | |
| persist-credentials: false | |
| path: catalog | |
| - name: Synchronize workflow catalog | |
| run: >- | |
| python3 scripts/sync_catalog.py sync | |
| workflow-templates | |
| catalog/workflow-templates | |
| --manifest workflow-catalog.json | |
| --report catalog-sync-report.json | |
| - name: Create catalog update pull request | |
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| path: catalog | |
| commit-message: 'chore: sync LibreCode workflow catalog' | |
| committer: GitHub <noreply@github.com> | |
| author: github-workflows bot <noreply@github.com> | |
| signoff: true | |
| branch: automated/sync-workflow-catalog | |
| delete-branch: true | |
| title: 'chore: sync workflow catalog' | |
| body: | | |
| Automated synchronization from `LibreCodeCoop/github-workflows`. | |
| The files in `workflow-templates/` are generated and validated in the source repository. Review this pull request before publishing the updated organization catalog. | |
| add-paths: | | |
| workflow-templates/** |