Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
fc8cc213
Unverified
Commit
fc8cc213
authored
Sep 13, 2019
by
Massimiliano Pippi
Committed by
GitHub
Sep 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add stale bot for issues (#404)
parent
d94fe6c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
0 deletions
+106
-0
.github/workflows/stale.yaml
.github/workflows/stale.yaml
+106
-0
No files found.
.github/workflows/stale.yaml
0 → 100644
View file @
fc8cc213
name
:
stale-bot
on
:
schedule
:
# run every day at midnight
-
cron
:
'
0
0
*
*
*'
issue_comment
:
types
:
[
'
created'
]
jobs
:
stale-bot
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Mark stale
if
:
github.event_name == 'schedule'
uses
:
actions/github-script@0.2.0
with
:
github-token
:
${{github.token}}
script
:
|
// Get a list of all open issues labeled `waiting for feedback`
const opts = github.issues.listForRepo.endpoint.merge({
...context.repo,
state: 'open',
labels: ['waiting for feedback'],
});
const issues = await github.paginate(opts);
// Set this value to whatever makes sense for the repo.
let elapsedDays = 15
let elapsed = elapsedDays * 24 * 60 * 60 * 1000;
let now = new Date();
for (const issue of issues) {
// If an issue was active in the past 15 days, leave it alone.
if (now - new Date(issue.updated_at).getTime() < elapsedDays) {
continue;
}
// If we're here, we've been waiting for feedback for more than
// 15 days, mark as stale.
github.issues.addLabels({
...context.repo,
issue_number: issue.number,
labels: ['stale']
});
}
-
name
:
Mark active
uses
:
actions/github-script@0.2.0
with
:
github-token
:
${{github.token}}
script
:
|
// Every time a comment is added to an issue, close it if it contains
// the `stale` label.
// Load issue's labels.
const opts = github.issues.listLabelsOnIssue.endpoint.merge({
...context.repo,
issue_number: context.issue.number
});
const labels = await github.paginate(opts);
// Search for `stale`.
for (const label of labels) {
if (label.name === 'stale') {
await github.issues.removeLabel({
...context.repo,
issue_number: context.issue.number,
name: 'stale'
})
return;
}
}
-
name
:
Close stale
if
:
github.event_name == 'schedule'
uses
:
actions/github-script@0.2.0
with
:
github-token
:
${{github.token}}
script
:
|
// Load all the `stale` issues
const opts = github.issues.listForRepo.endpoint.merge({
...context.repo,
state: 'open',
labels: ['stale'],
});
const issues = await github.paginate(opts);
// Set this value to whatever makes sense for the repo.
let elapsedDays = 30;
let elapsed = elapsedDays * 24 * 60 * 60 * 1000;
let now = new Date();
for (const issue of issues) {
// If an issue was stale for less than elapsed time, leave it alone.
if (now - new Date(issue.updated_at).getTime() < elapsed) {
continue;
}
// Close the stale issue.
await github.issues.update({
...context.repo,
issue_number: issue.number,
state: 'closed'
});
}
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