Mirror to sourcebot-private #8
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: Mirror to sourcebot-private | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| - "setup-sourcebot-v*" | |
| # Release commits use `[skip ci]`, which suppresses push-triggered workflows. | |
| workflow_run: | |
| workflows: | |
| - Release Sourcebot (Production) | |
| - Release setup-sourcebot | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: mirror-sourcebot-private | |
| cancel-in-progress: false | |
| jobs: | |
| mirror: | |
| if: github.repository == 'sourcebot-dev/sourcebot' | |
| runs-on: ubuntu-latest | |
| environment: sourcebot-private-mirror | |
| steps: | |
| - name: Check out complete repository history | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| persist-credentials: false | |
| - name: Create mirror installation token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| client-id: ${{ vars.MIRROR_APP_CLIENT_ID }} | |
| private-key: ${{ secrets.MIRROR_APP_PRIVATE_KEY }} | |
| owner: sourcebot-dev | |
| repositories: sourcebot-private | |
| permission-contents: write | |
| permission-workflows: write | |
| - name: Mirror main and tags | |
| env: | |
| MIRROR_TOKEN: ${{ steps.app-token.outputs.token }} | |
| shell: bash | |
| run: | | |
| git remote add private \ | |
| "https://x-access-token:${MIRROR_TOKEN}@github.com/sourcebot-dev/sourcebot-private.git" | |
| git push --atomic private HEAD:refs/heads/main --tags |