-
Notifications
You must be signed in to change notification settings - Fork 17
49 lines (42 loc) · 1.48 KB
/
deploy-instance-pr-actions.yml
File metadata and controls
49 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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