Skip to content

Commit c59abba

Browse files
authored
Merge pull request #1779 from dxc-technology/Mil4n0r/github_issues-bot
Added Github Bot
2 parents e8012fc + 5df5403 commit c59abba

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

.github/workflows/create-issue.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Inform new issue
2+
3+
on:
4+
issues:
5+
types:
6+
- opened
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Install Node.js 18.x
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: 18.x
20+
registry-url: https://registry.npmjs.org/
21+
22+
- name: Install scripts dependencies
23+
run: cd scripts && npm install
24+
25+
- name: Run Autorespond Script
26+
run:
27+
node scripts/new_issue-message.js
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Close inactive issues
2+
on:
3+
schedule:
4+
- cron: "0 1 * * *"
5+
6+
jobs:
7+
close-issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
steps:
13+
- uses: actions/stale@v5
14+
with:
15+
days-before-issue-stale: 15
16+
days-before-issue-close: 15
17+
stale-issue-label: "stale"
18+
stale-issue-message: "This issue is stale because it has been open for 15 days with no activity. If there are no further updates or modifications within the next 15 days, it will be automatically closed."
19+
close-issue-message: "This issue has been closed as it has been inactive for 15 days since being marked as stale."
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}

scripts/new_issue-message.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { context, getOctokit } = require('@actions/github');
2+
3+
const newIssueMessage = async () => {
4+
try {
5+
const octokit = getOctokit(process.env.GITHUB_TOKEN);
6+
const issueComment =
7+
`Thank you for opening an issue! 🚀
8+
9+
Our team will review it as soon as possible. In the meantime, please make sure that you've provided all the necessary details to help us understand and address the issue effectively.
10+
11+
Feel free to contribute and participate in discussions!`
12+
13+
await octokit.rest.issues.createComment({
14+
...context.repo,
15+
issue_number: context.issue.number,
16+
body: issueComment,
17+
});
18+
} catch (error) {
19+
console.error(error);
20+
process.exit(1);
21+
}
22+
}
23+
24+
newIssueMessage();

scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"url": "https://dxc.com"
99
},
1010
"dependencies": {
11+
"@actions/github": "^6.0.0",
1112
"aws-sdk": "^2.1369.0"
1213
}
1314
}

0 commit comments

Comments
 (0)