Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
fengzch-das
nunchaku
Commits
35aab2fb
Commit
35aab2fb
authored
Jul 08, 2025
by
Muyang Li
Browse files
chore: add a workflow to reopen the inactive issues
parent
ed451a8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
1 deletion
+72
-1
.github/workflows/close-inactive-issues.yaml
.github/workflows/close-inactive-issues.yaml
+1
-1
.github/workflows/reopen-issues.yaml
.github/workflows/reopen-issues.yaml
+71
-0
No files found.
.github/workflows/close-inactive-issues.yaml
View file @
35aab2fb
...
...
@@ -69,7 +69,7 @@ jobs:
owner,
repo,
issue_number: issue.number,
body: 'This issue has been automatically closed due to 30-day inactivity. Please feel free to reopen it if needed.'
body: 'This issue has been automatically closed due to 30-day inactivity. Please feel free to reopen it
with `/reopen`
if needed.'
});
console.log(`Closed issue #${issue.number} due to inactivity.`);
} catch (error) {
...
...
.github/workflows/reopen-issues.yaml
0 → 100644
View file @
35aab2fb
name
:
Reopen Inactive Issues on /reopen Command
on
:
issue_comment
:
types
:
[
created
]
permissions
:
issues
:
write
contents
:
read
jobs
:
reopen-issue
:
if
:
github.repository == 'mit-han-lab/nunchaku'
runs-on
:
ubuntu-latest
steps
:
-
name
:
Check if comment is /reopen by issue creator and reopen only if issue has inactive label
uses
:
actions/github-script@v6
with
:
github-token
:
${{ secrets.GITHUB_TOKEN }}
script
:
|
const commentBody = context.payload.comment.body.trim();
const issueNumber = context.payload.issue.number;
const commentAuthor = context.payload.comment.user.login;
const issueAuthor = context.payload.issue.user.login;
// Get current labels on the issue
const labels = context.payload.issue.labels.map(label => label.name);
if (commentBody === '/reopen') {
if (commentAuthor === issueAuthor) {
if (labels.includes('inactive')) {
if (context.payload.issue.state === 'closed') {
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
try {
// Reopen the issue
await github.rest.issues.update({
owner,
repo,
issue_number: issueNumber,
state: 'open',
});
// Remove 'inactive' label
const newLabels = labels.filter(label => label !== 'inactive');
await github.rest.issues.update({
owner,
repo,
issue_number: issueNumber,
labels: newLabels,
});
await github.rest.issues.createComment({
owner,
repo,
issue_number: issueNumber,
body: `Issue reopened by @${commentAuthor} via /reopen command.`,
});
console.log(`Reopened issue #${issueNumber} with 'inactive' label by issuer.`);
} catch (error) {
console.error(`Failed to reopen issue #${issueNumber}: ${error.message}`);
}
} else {
console.log(`Issue #${issueNumber} is already open.`);
}
} else {
console.log(`Issue #${issueNumber} does not have 'inactive' label, skipping.`);
}
} else {
console.log(`Commenter @${commentAuthor} is not the issue creator @${issueAuthor}, ignoring.`);
}
} else {
console.log(`Comment is not /reopen, ignoring.`);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment