[pre-commit.ci] pre-commit autoupdate #256
Workflow file for this run
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 instance PR | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [closed, reopened] | |
| jobs: | |
| sync_pr_status: | |
| runs-on: ubuntu-latest | |
| env: | |
| INSTANCE_REPO_GITHUB: scverse/cookiecutter-scverse-instance | |
| steps: | |
| - name: Generate tokens | |
| id: app-token | |
| uses: actions/create-github-app-token@v2 | |
| with: | |
| app-id: ${{ vars.PR_CREATOR_APP_ID }} | |
| private-key: ${{ secrets.PR_CREATOR_PRIVATE_KEY }} | |
| repositories: cookiecutter-scverse-instance | |
| - name: Authenticate gh CLI with app token | |
| run: echo "${{ steps.app-token.outputs.token }}" | gh auth login --with-token | |
| - name: Define sister PR branch name | |
| run: | | |
| echo "SISTER_PR_BRANCH=pr-${{ github.event.pull_request.number }}" >> $GITHUB_ENV | |
| - name: Check if "sister PR" exists and find its ID | |
| run: | | |
| PR_ID=$( \ | |
| gh pr view $SISTER_PR_BRANCH \ | |
| -R $INSTANCE_REPO_GITHUB \ | |
| --json number --jq '.number' \ | |
| || echo "NA" | |
| ) | |
| echo "SISTER_PR_ID=$PR_ID" >> $GITHUB_ENV | |
| - name: When closing or merging also close sister PR | |
| if: ${{ env.SISTER_PR_ID != 'NA' }} | |
| run: | | |
| gh pr close $SISTER_PR_ID \ | |
| -R $INSTANCE_REPO_GITHUB | |
| - name: Reopen sister PR | |
| if: ${{ env.SISTER_PR_ID != 'NA' && github.event.action == 'reopened' }} | |
| run: | | |
| gh pr reopen $SISTER_PR_ID \ | |
| -R $INSTANCE_REPO_GITHUB |