Skip to content

Commit 4a8eda5

Browse files
committed
maint: workflow to set default issue type
Signed-off-by: Yury V. Zaytsev <[email protected]>
1 parent c0b9150 commit 4a8eda5

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Process incoming issues
2+
3+
on:
4+
issues:
5+
types: [ opened ]
6+
7+
env:
8+
GQL_HEADERS: "{headers: {'GraphQL-Features': 'issue_types'}}"
9+
ISSUE_TYPE_TASK_ID: IT_kwDOABIuus4AAqnX
10+
11+
jobs:
12+
set-default-issue-type:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
16+
if: ${{ ! github.event.issue.pull_request }}
17+
18+
permissions:
19+
issues: write
20+
21+
steps:
22+
- uses: actions/github-script@v7
23+
id: get-issue-type
24+
with:
25+
script: |
26+
return github.graphql(`
27+
query {
28+
repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") {
29+
issue(number: ${{ github.event.issue.number }}) {
30+
issueType {
31+
name
32+
}
33+
}
34+
}
35+
}
36+
`, ${{ env.GQL_HEADERS }})
37+
38+
- run: echo "${{ steps.get-issue-type.outputs.result }}"
39+
40+
- uses: actions/github-script@v7
41+
id: set-issue-type
42+
if: ${{ ! steps.get-issue-type.outputs.result.repository.issue.issueType }}
43+
with:
44+
script: |
45+
return github.graphql(`
46+
mutation {
47+
updateIssueIssueType(input: {
48+
issueId: "${{ github.event.issue.node_id }}",
49+
issueTypeId: "${{ env.ISSUE_TYPE_TASK_ID }}"
50+
}) {
51+
issue {
52+
id
53+
}
54+
}
55+
}
56+
`, ${{ env.GQL_HEADERS }})
57+
58+
- run: |
59+
gh issue edit ${{ github.event.issue.number }} \
60+
--milestone "Future Releases"
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
GH_REPO: ${{ github.repository }}

0 commit comments

Comments
 (0)