Skip to content

Commit 98cad44

Browse files
testing workflow
1 parent b9670b5 commit 98cad44

File tree

7 files changed

+93
-79
lines changed

7 files changed

+93
-79
lines changed
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Auto Comment on PR Merge
24

35
on:
@@ -10,11 +12,11 @@ jobs:
1012
runs-on: ubuntu-latest
1113

1214
steps:
13-
- name: Add Comment to Merged PR
14-
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
run: |
17-
curl -H "Authorization: token $GITHUB_TOKEN" \
18-
-X POST \
19-
-d '{"body":"🎉 Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀"}' \
20-
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
15+
- name: Add Comment to Merged PR
16+
env:
17+
TOKEN: ${{ secrets.TOKEN }}
18+
run: |
19+
curl -H "Authorization: token $TOKEN" \
20+
-X POST \
21+
-d '{"body":"🎉 Your pull request has been successfully merged! 🎉 Thank you for your contribution to our project. Your efforts are greatly appreciated. Keep up the fantastic work! 🚀"}' \
22+
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Check for Duplicates and Close Issues on PR Merge
24

35
on:
@@ -8,42 +10,42 @@ jobs:
810
check-duplicates:
911
runs-on: ubuntu-latest
1012
steps:
11-
- name: Checkout repository
12-
uses: actions/checkout@v2
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
1315

14-
- name: Check for duplicate entries in product.json
15-
run: |
16-
# Check for duplicate entries based on the 'link' field in product.json
17-
jq -r '.[].link' product.json | sort | uniq -d > duplicates.txt
18-
if [ -s duplicates.txt ]; then
19-
echo "Duplicate entries found in product.json based on 'link':"
20-
cat duplicates.txt
21-
exit 1
22-
else
23-
echo "No duplicate entries found based on 'link'."
24-
fi
16+
- name: Check for duplicate entries in product.json
17+
run: |
18+
# Check for duplicate entries based on the 'link' field in product.json
19+
jq -r '.[].link' product.json | sort | uniq -d > duplicates.txt
20+
if [ -s duplicates.txt ]; then
21+
echo "Duplicate entries found in product.json based on 'link':"
22+
cat duplicates.txt
23+
exit 1
24+
else
25+
echo "No duplicate entries found based on 'link'."
26+
fi
2527
2628
close-issues:
2729
runs-on: ubuntu-latest
2830
needs: check-duplicates
2931
if: github.event.pull_request.merged == true
3032

3133
steps:
32-
- name: Checkout repository
33-
uses: actions/checkout@v2
34+
- name: Checkout repository
35+
uses: actions/checkout@v2
3436

35-
- name: Close linked issues
36-
run: |
37-
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
38-
for ISSUE in $ISSUES
39-
do
40-
echo "Closing issue #$ISSUE"
41-
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
42-
-H "Accept: application/vnd.github.v3+json" \
43-
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
44-
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
45-
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
46-
-H "Accept: application/vnd.github.v3+json" \
47-
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
48-
-d '{"state":"closed"}'
49-
done
37+
- name: Close linked issues
38+
run: |
39+
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
40+
for ISSUE in $ISSUES
41+
do
42+
echo "Closing issue #$ISSUE"
43+
curl -X POST -H "Authorization: token ${{ secrets.TOKEN }}" \
44+
-H "Accept: application/vnd.github.v3+json" \
45+
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
46+
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
47+
curl -X PATCH -H "Authorization: token ${{ secrets.TOKEN }}" \
48+
-H "Accept: application/vnd.github.v3+json" \
49+
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
50+
-d '{"state":"closed"}'
51+
done
Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Close Stale PRs
24

35
on:
@@ -18,17 +20,17 @@ jobs:
1820
runs-on: ubuntu-latest
1921
permissions:
2022
pull-requests: write
21-
23+
2224
steps:
23-
- uses: actions/stale@v7
24-
with:
25-
repo-token: ${{ secrets.GITHUB_TOKEN }}
26-
stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.'
27-
days-before-pr-stale: 15
28-
days-before-pr-close: 0
29-
exempt-pr-author: false
30-
exempt-pr-labels: ''
31-
only-labels: ''
32-
operations-per-run: 30
33-
remove-stale-when-updated: true
34-
debug-only: false
25+
- uses: actions/stale@v7
26+
with:
27+
repo-token: ${{ secrets.TOKEN }}
28+
stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.'
29+
days-before-pr-stale: 15
30+
days-before-pr-close: 0
31+
exempt-pr-author: false
32+
exempt-pr-labels: ''
33+
only-labels: ''
34+
operations-per-run: 30
35+
remove-stale-when-updated: true
36+
debug-only: false
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Close Issues on PR Merge
24

35
on:
@@ -9,22 +11,22 @@ jobs:
911
runs-on: ubuntu-latest
1012

1113
steps:
12-
- name: Checkout repository
13-
uses: actions/checkout@v2
14+
- name: Checkout repository
15+
uses: actions/checkout@v2
1416

15-
- name: Close linked issues
16-
if: github.event.pull_request.merged == true
17-
run: |
18-
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
19-
for ISSUE in $ISSUES
20-
do
21-
echo "Closing issue #$ISSUE"
22-
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
23-
-H "Accept: application/vnd.github.v3+json" \
24-
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
25-
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
26-
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
27-
-H "Accept: application/vnd.github.v3+json" \
28-
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
29-
-d '{"state":"closed"}'
30-
done
17+
- name: Close linked issues
18+
if: github.event.pull_request.merged == true
19+
run: |
20+
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
21+
for ISSUE in $ISSUES
22+
do
23+
echo "Closing issue #$ISSUE"
24+
curl -X POST -H "Authorization: token ${{ secrets.TOKEN }}" \
25+
-H "Accept: application/vnd.github.v3+json" \
26+
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
27+
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
28+
curl -X PATCH -H "Authorization: token ${{ secrets.TOKEN }}" \
29+
-H "Accept: application/vnd.github.v3+json" \
30+
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
31+
-d '{"state":"closed"}'
32+
done

.github/workflows/greetings.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Greetings
24

35
on: [pull_request_target, issues]
@@ -9,8 +11,8 @@ jobs:
911
issues: write
1012
pull-requests: write
1113
steps:
12-
- uses: actions/first-interaction@v1
13-
with:
14-
repo-token: ${{ secrets.GITHUB_TOKEN }}
15-
issue-message: "Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. We aim to respond or assign your issue as soon as possible."
16-
pr-message: "Welcome to Our repository.🎊 Thank you so much for taking the time to point this out."
14+
- uses: actions/first-interaction@v1
15+
with:
16+
repo-token: ${{ secrets.TOKEN }}
17+
issue-message: 'Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. We aim to respond or assign your issue as soon as possible.'
18+
pr-message: 'Welcome to Our repository.🎊 Thank you so much for taking the time to point this out.'

.github/workflows/greetings.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: 'Greetings'
24

35
on:
@@ -16,9 +18,9 @@ jobs:
1618
- uses: actions/checkout@v1
1719
- uses: EddieHubCommunity/gh-action-community/src/welcome@main
1820
with:
19-
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
github-token: ${{ secrets.TOKEN }}
2022
issue-message: |
2123
Congratulations, @${{ github.actor }}! 🎉 Thank you for creating your issue. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work!
2224
pr-message: |
2325
Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.
24-
footer: 'We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our [contributing guidelines](https://github.com/HimanshuNarware/Devlabs/blob/main/CONTRIBUTING.md)'
26+
footer: 'We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our [contributing guidelines](https://github.com/HimanshuNarware/Devlabs/blob/main/CONTRIBUTING.md)'

.github/workflows/restrict_pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# @format
2+
13
name: Restrict Contributor to limited contributions in Devlabs
24

35
on:
@@ -14,7 +16,7 @@ jobs:
1416
id: calculate_score
1517
uses: actions/github-script@v4
1618
with:
17-
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
19+
github-token: ${{ secrets.TOKEN }}
1820
script: |
1921
const owner = context.repo.owner;
2022
const repo = context.repo.repo;
@@ -79,7 +81,7 @@ jobs:
7981
if: always() && steps.calculate_score.outputs.close_pull_request == 'true'
8082
uses: actions/github-script@v4
8183
with:
82-
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
84+
github-token: ${{ secrets.TOKEN }}
8385
script: |
8486
const owner = context.repo.owner;
8587
const repo = context.repo.repo;
@@ -110,4 +112,4 @@ jobs:
110112
repo,
111113
pull_number: pullRequestNumber,
112114
state: 'closed'
113-
});
115+
});

0 commit comments

Comments
 (0)