-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (58 loc) · 2.03 KB
/
issue-pull-request-closed.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
54
55
56
57
58
59
60
name: Remove from Hot
on:
pull_request_target:
types:
- closed
issues:
types:
- closed
- deleted
jobs:
remove-from-hot:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GH_TOKEN_ORG_ADMIN}}
steps:
- name: Get the item id
env:
ORGANIZATION: asyncapi
PROJECT_NUMBER: 9
ISSUE_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
run: |
gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
items(first:100) {
nodes {
id
content {
... on Issue {
id
}
... on PullRequest {
id
}
}
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > item_ids.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' item_ids.json) >> $GITHUB_ENV
echo 'ITEM_ID='$(jq '.data.organization.projectNext.items.nodes[] | select(.content.id=="'$ISSUE_ID'") | .id' item_ids.json) >> $GITHUB_ENV
- name: Remove Issue/PR From Projects
run: |
item_id="$( gh api graphql --header 'GraphQL-Features: projects_next_graphql' -f query='
mutation($project:ID!, $item_id:ID!) {
deleteProjectNextItem(
input: {
projectId: $project
itemId: $item_id
}
) {
deletedItemId
}
}' -f project=$PROJECT_ID -f item_id=$ITEM_ID --jq '.data.deleteProjectNextItem.projectNextItem.deletedItemId')"
echo 'Item with ID: '$item_id' Has been removed.'