mirror of
https://github.com/gethomepage/homepage.git
synced 2026-05-18 19:40:58 +08:00
Add discussion triage workflow
This commit is contained in:
49
.github/workflows/issue-triage.yml
vendored
49
.github/workflows/issue-triage.yml
vendored
@@ -3,14 +3,17 @@ name: Issue Triage
|
||||
on:
|
||||
issues:
|
||||
types: [labeled]
|
||||
discussion:
|
||||
types: [labeled]
|
||||
|
||||
permissions:
|
||||
discussions: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
close-needs-discussion:
|
||||
name: Issues Need Discussion
|
||||
if: github.event.label.name == 'needs-discussion'
|
||||
if: github.event_name == 'issues' && github.event.label.name == 'needs-discussion'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
@@ -41,3 +44,47 @@ jobs:
|
||||
issue_number: issueNumber,
|
||||
lock_reason: 'off-topic',
|
||||
});
|
||||
|
||||
comment-needs-information:
|
||||
name: Discussions Need Information
|
||||
if: github.event_name == 'discussion' && github.event.label.name == 'needs-information'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
const discussionNumber = context.payload.discussion.number;
|
||||
let discussionId = context.payload.discussion.node_id;
|
||||
|
||||
if (!discussionId) {
|
||||
const result = await github.graphql(
|
||||
`query($owner:String!, $repo:String!, $number:Int!) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
discussion(number:$number) {
|
||||
id
|
||||
}
|
||||
}
|
||||
}`,
|
||||
{
|
||||
owner,
|
||||
repo,
|
||||
number: discussionNumber,
|
||||
},
|
||||
);
|
||||
|
||||
discussionId = result.repository.discussion.id;
|
||||
}
|
||||
|
||||
await github.graphql(
|
||||
`mutation($discussion:ID!, $body:String!) {
|
||||
addDiscussionComment(input:{discussionId:$discussion, body:$body}) {
|
||||
clientMutationId
|
||||
}
|
||||
}`,
|
||||
{
|
||||
discussion: discussionId,
|
||||
body: 'Dear homepage user, thanks for opening this discussion! Please ensure you add the output from the troubleshooting guide steps, the support template asks for those details because they usually make it possible to understand the problem without guessing. Please update the discussion with the relevant troubleshooting output, configuration, logs, and browser console details where applicable: https://gethomepage.dev/troubleshooting/. Thank you!',
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user