Sync Two Wiki Repos #203
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: Sync Two Wiki Repos | |
| on: [gollum] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| # Ensure scripts are run with pipefail. See: | |
| # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: azure | |
| deployment: false | |
| steps: | |
| - name: Get repo name | |
| run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV | |
| - name: Checkout ${{ env.BASENAME }}-wiki | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: '${{ github.repository_owner }}/${{ env.BASENAME }}-wiki' | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | |
| with: | |
| client-id: ${{ vars.AZURE_CLIENT_ID }} | |
| tenant-id: ${{ vars.AZURE_TENANT_ID }} | |
| subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} | |
| - name: Create GitHub App token | |
| id: app-token | |
| uses: microsoft/create-github-app-token-via-key-vault@5ba0d436e9c3cac52feff4d1f2f66f9698ce4a2d # v1 | |
| with: | |
| client-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID }} | |
| key-id: ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID }} | |
| owner: microsoft | |
| repositories: | | |
| TypeScript | |
| TypeScript-wiki | |
| permission-contents: write | |
| - name: Configure git for GitHub App token | |
| shell: bash | |
| env: | |
| GITHUB_APP_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: | | |
| set -euo pipefail | |
| basic_auth="$(node -e 'process.stdout.write(Buffer.from("x-access-token:" + process.env.GITHUB_APP_TOKEN).toString("base64"))')" | |
| echo "::add-mask::$basic_auth" | |
| git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${basic_auth}" | |
| - name: Run sync | |
| run: ./.github/workflows/sync | |
| env: | |
| PUSHER: typescript-automation[bot] <290192711+typescript-automation[bot]@users.noreply.github.com> | |
| AUTH: ${{ steps.app-token.outputs.token }} |