Skip to content

Commit 3bd6b7c

Browse files
committed
Automatically add PRs to Rikolti MVP Project
1 parent e63d778 commit 3bd6b7c

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Add PRs to Rikolti MVP Project
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- labeled
9+
10+
jobs:
11+
add-to-project:
12+
name: Add PR to Rikolti MVP Project
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Add To GitHub projects
16+
uses: actions/[email protected]
17+
with:
18+
project-url: https://github.com/orgs/ucldc/projects/1
19+
github-token: ${{ secrets.AMY_ADD_TO_PROJECT_TOKEN }}
20+
id: add-project
21+
- name: Get Current Sprint ID
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.AMY_ADD_TO_PROJECT_TOKEN }}
24+
run: |
25+
gh api graphql -f query='
26+
query($org: String!, $number: Int!) {
27+
organization(login: $org){
28+
projectV2(number: $number) {
29+
field(name: "Sprint") {
30+
... on ProjectV2IterationField {
31+
id
32+
name
33+
configuration {
34+
completedIterations {
35+
id
36+
title
37+
startDate
38+
}
39+
iterations {
40+
id
41+
title
42+
startDate
43+
}
44+
}
45+
}
46+
}
47+
}
48+
}
49+
}' -f org=ucldc -F number=1 > sprint_data.json
50+
CURRENT_SPRINT_ID=$(jq -r '
51+
.data.organization.projectV2.field.configuration.iterations
52+
| sort_by(.startDate)
53+
| .[0].id' sprint_data.json)
54+
echo "CURRENT_SPRINT_ID=$CURRENT_SPRINT_ID" >> $GITHUB_ENV
55+
- name: Check env
56+
run: echo $CURRENT_SPRINT_ID
57+
- name: Update Project Fields
58+
uses: titoportas/[email protected]
59+
with:
60+
project-url: https://github.com/orgs/ucldc/projects/1
61+
github-token: ${{ secrets.AMY_ADD_TO_PROJECT_TOKEN }}
62+
item-id: ${{ steps.add-project.outputs.itemId }}
63+
field-keys: Sprint
64+
field-values: ${{ env.CURRENT_SPRINT_ID }}
65+
66+
67+

0 commit comments

Comments
 (0)