chore: establish repository synchronization baseline #2
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
| name: Dispatch RepoOps sync | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: dispatch-repo-ops-sync | |
| cancel-in-progress: false | |
| jobs: | |
| dispatch: | |
| if: vars.REPO_OPS_SYNC_ENABLED == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create Dispatcher App token | |
| id: app-token | |
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | |
| with: | |
| app-id: ${{ vars.REPO_OPS_DISPATCHER_APP_ID }} | |
| private-key: ${{ secrets.REPO_OPS_DISPATCHER_APP_PRIVATE_KEY }} | |
| repositories: ${{ secrets.REPO_OPS_MONO_REPOSITORY }} | |
| permission-contents: write | |
| - name: Dispatch the private sync worker | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| PUBLIC_SHA: ${{ github.sha }} | |
| MONO_REPOSITORY: ${{ secrets.REPO_OPS_MONO_REPOSITORY }} | |
| run: | | |
| set -euo pipefail | |
| [[ "$MONO_REPOSITORY" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] | |
| [[ "$PUBLIC_SHA" =~ ^[0-9a-f]{40}$ ]] | |
| gh api "repos/${MONO_REPOSITORY}/dispatches" \ | |
| --method POST \ | |
| --field event_type=repo-ops-public-push \ | |
| --field "client_payload[public_sha]=$PUBLIC_SHA" |