forked from Submitty/Submitty
-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (47 loc) · 2.11 KB
/
sort_draft_prs.yml
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
50
51
52
53
name: Move drafts to WIP and un-drafts to seeking reviewer
on:
pull_request_target:
types:
- opened
- converted_to_draft
- ready_for_review
env:
PR_ID: ${{ github.event.pull_request.number }}
jobs:
sort-drafts:
name: Move drafts to WIP and un-drafts to seeking reviewer
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PEM }}
- name: Get PR project ID
id: get-pr-id
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
PR_PROJECT_ID="$(gh project item-list -L 9999 --owner Submitty 1 --format json --jq "[.items[] | {id, labels, status, title: .content.title, repo: .content.repository, number: .content.number}] | .[] | select(.number == "$PR_ID").id")"
echo "pr-project-id="${PR_PROJECT_ID:?}"" >> "$GITHUB_OUTPUT"
- name: Checkout the repo
uses: actions/checkout@v4
- name: Move draft to Work in Progress
if: ${{ (github.event.action == 'converted_to_draft') || ((github.event.action == 'opened') && (github.event.pull_request.draft == true)) }}
env:
PR_PROJECT_ID: ${{ steps.get-pr-id.outputs.pr-project-id }}
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
source .github/bin/board_automation_helper.sh
gh project item-edit --project-id "$PROJECT_ID" --id "$PR_PROJECT_ID" --field-id "$STATUS_FIELD_ID" --single-select-option-id "$WIP_ID"
shell: bash
- name: Move ready for review to Seeking Reviewer
if: ${{ github.event.action == 'ready_for_review' }}
env:
PR_PROJECT_ID: ${{ steps.get-pr-id.outputs.pr-project-id }}
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
source .github/bin/board_automation_helper.sh
gh project item-edit --project-id "$PROJECT_ID" --id "$PR_PROJECT_ID" --field-id "$STATUS_FIELD_ID" --single-select-option-id "$SEEKING_REVIEWER_ID"
shell: bash