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
189be8bf
Commit
189be8bf
authored
Jul 08, 2025
by
Muyang Li
Browse files
[Auto Merge] chore: /reopen can be used in any issue
parents
c80de1e6
2a785f77
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
30 deletions
+26
-30
.github/workflows/reopen-issues.yaml
.github/workflows/reopen-issues.yaml
+26
-30
No files found.
.github/workflows/reopen-issues.yaml
View file @
189be8bf
name
:
Reopen
Inactive
Issue
s
on /reopen Command
name
:
Reopen Issue on /reopen Command
on
:
on
:
issue_comment
:
issue_comment
:
types
:
[
created
]
types
:
[
created
]
...
@@ -10,7 +10,7 @@ jobs:
...
@@ -10,7 +10,7 @@ jobs:
if
:
github.repository == 'mit-han-lab/nunchaku'
if
:
github.repository == 'mit-han-lab/nunchaku'
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
-
name
:
Check if comment is /reopen by issue creator and reopen
only if issue has inactive label
-
name
:
Check if comment is /reopen by issue creator and reopen
uses
:
actions/github-script@v6
uses
:
actions/github-script@v6
with
:
with
:
github-token
:
${{ secrets.GITHUB_TOKEN }}
github-token
:
${{ secrets.GITHUB_TOKEN }}
...
@@ -20,24 +20,22 @@ jobs:
...
@@ -20,24 +20,22 @@ jobs:
const commentAuthor = context.payload.comment.user.login;
const commentAuthor = context.payload.comment.user.login;
const issueAuthor = context.payload.issue.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 (commentBody === '/reopen') {
if (commentAuthor === issueAuthor) {
if (commentAuthor === issueAuthor) {
if (labels.includes('inactive')) {
// Only proceed if issue is currently closed
if (context.payload.issue.state === 'closed') {
if (context.payload.issue.state === 'closed') {
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
try {
try {
// Reopen the issue
await github.rest.issues.update({
await github.rest.issues.update({
owner,
owner,
repo,
repo,
issue_number: issueNumber,
issue_number: issueNumber,
state: 'open',
state: 'open',
});
});
// Remove 'inactive' label
// Remove 'inactive' label if present
const labels = context.payload.issue.labels.map(label => label.name);
if (labels.includes('inactive')) {
const newLabels = labels.filter(label => label !== 'inactive');
const newLabels = labels.filter(label => label !== 'inactive');
await github.rest.issues.update({
await github.rest.issues.update({
owner,
owner,
...
@@ -45,23 +43,21 @@ jobs:
...
@@ -45,23 +43,21 @@ jobs:
issue_number: issueNumber,
issue_number: issueNumber,
labels: newLabels,
labels: newLabels,
});
});
}
await github.rest.issues.createComment({
await github.rest.issues.createComment({
owner,
owner,
repo,
repo,
issue_number: issueNumber,
issue_number: issueNumber,
body: `Issue reopened by @${commentAuthor} via \`/reopen\` command.`,
body: `Issue reopened by @${commentAuthor} via \`/reopen\` command.`,
});
});
console.log(`Reopened issue #${issueNumber} with 'inactive' label by issuer.`);
console.log(`Reopened issue #${issueNumber} by request of issuer.`);
} catch (error) {
} catch (error) {
console.error(`Failed to reopen issue #${issueNumber}: ${error.message}`);
console.error(`Failed to reopen issue #${issueNumber}: ${error.message}`);
}
} else {
console.log(`Issue #${issueNumber} is already open.`);
}
}
} else {
} else {
console.log(`Issue #${issueNumber}
does not have 'inactive' label, skipping
.`);
console.log(`Issue #${issueNumber}
is already open
.`);
}
}
} else {
} else {
console.log(`Commenter @${commentAuthor} is not the issue creator @${issueAuthor}, ignoring.`);
console.log(`Commenter @${commentAuthor} is not the issue creator @${issueAuthor}, 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