-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from AnushkaChouhan25/main
ADD CICD Workflows for GITHUB Automation
- Loading branch information
Showing
6 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# .github/workflows/auto-comment-issues.yml | ||
name: Auto Comment on Issues | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment on issue | ||
uses: peter-evans/commit-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: 'Thank you for opening this issue! We will get back to you soon.' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# .github/workflows/auto-comment-prs.yml | ||
name: Auto Comment on PR | ||
|
||
on: | ||
pull_request: | ||
types: [opened] | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment on PR | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.payload.pull_request.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Thanks for the PR! We will review it shortly.' | ||
}); | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# .github/workflows/close-issues-on-pr-merge.yml | ||
name: Close Issues on PR Merge | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
close-issues: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Close associated issues | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const issueNumbers = context.payload.pull_request.body.match(/#(\\d+)/g); | ||
if (issueNumbers) { | ||
for (const issue of issueNumbers) { | ||
await github.issues.update({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: parseInt(issue.replace('#', '')), | ||
state: 'closed', | ||
}); | ||
} | ||
} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# .github/workflows/comment-on-issue-close.yml | ||
name: Comment on Issue Close | ||
|
||
on: | ||
issues: | ||
types: [closed] | ||
|
||
jobs: | ||
comment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment on issue close | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.payload.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'This issue has been closed. If you have further questions, feel free to open a new one.' | ||
}); | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# .github/workflows/comment-on-pr-merge.yml | ||
name: Comment on PR Merge | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
comment: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment on merged PR | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.payload.pull_request.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'The PR has been successfully merged. Thank you for your contribution!' | ||
}); | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# .github/workflows/label-issues-prs.yml | ||
name: Auto Label Issues and PRs | ||
|
||
on: | ||
issues: | ||
types: [opened] | ||
pull_request: | ||
types: [opened] | ||
|
||
jobs: | ||
label: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Add labels | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
const labels = context.eventName === 'issues' ? ['bug'] : ['review']; | ||
await github.issues.addLabels({ | ||
issue_number: context.payload.issue.number || context.payload.pull_request.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
labels: labels | ||
}); | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |