Skip to content

Commit

Permalink
testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HimanshuNarware committed Sep 4, 2024
1 parent b9670b5 commit 98cad44
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 79 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/auto-comment-on-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Auto Comment on PR Merge

on:
Expand All @@ -10,11 +12,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Add Comment to Merged PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -H "Authorization: token $GITHUB_TOKEN" \
-X POST \
-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! 🚀"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
- name: Add Comment to Merged PR
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
curl -H "Authorization: token $TOKEN" \
-X POST \
-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! 🚀"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
62 changes: 32 additions & 30 deletions .github/workflows/check_duplicate_tools.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Check for Duplicates and Close Issues on PR Merge

on:
Expand All @@ -8,42 +10,42 @@ jobs:
check-duplicates:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Check for duplicate entries in product.json
run: |
# Check for duplicate entries based on the 'link' field in product.json
jq -r '.[].link' product.json | sort | uniq -d > duplicates.txt
if [ -s duplicates.txt ]; then
echo "Duplicate entries found in product.json based on 'link':"
cat duplicates.txt
exit 1
else
echo "No duplicate entries found based on 'link'."
fi
- name: Check for duplicate entries in product.json
run: |
# Check for duplicate entries based on the 'link' field in product.json
jq -r '.[].link' product.json | sort | uniq -d > duplicates.txt
if [ -s duplicates.txt ]; then
echo "Duplicate entries found in product.json based on 'link':"
cat duplicates.txt
exit 1
else
echo "No duplicate entries found based on 'link'."
fi
close-issues:
runs-on: ubuntu-latest
needs: check-duplicates
if: github.event.pull_request.merged == true

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Close linked issues
run: |
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
for ISSUE in $ISSUES
do
echo "Closing issue #$ISSUE"
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
-d '{"state":"closed"}'
done
- name: Close linked issues
run: |
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
for ISSUE in $ISSUES
do
echo "Closing issue #$ISSUE"
curl -X POST -H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
curl -X PATCH -H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
-d '{"state":"closed"}'
done
28 changes: 15 additions & 13 deletions .github/workflows/close-old-pr-woc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Close Stale PRs

on:
Expand All @@ -18,17 +20,17 @@ jobs:
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.'
days-before-pr-stale: 15
days-before-pr-close: 0
exempt-pr-author: false
exempt-pr-labels: ''
only-labels: ''
operations-per-run: 30
remove-stale-when-updated: true
debug-only: false
- uses: actions/stale@v7
with:
repo-token: ${{ secrets.TOKEN }}
stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.'
days-before-pr-stale: 15
days-before-pr-close: 0
exempt-pr-author: false
exempt-pr-labels: ''
only-labels: ''
operations-per-run: 30
remove-stale-when-updated: true
debug-only: false
38 changes: 20 additions & 18 deletions .github/workflows/close-on-merge.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Close Issues on PR Merge

on:
Expand All @@ -9,22 +11,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

- name: Close linked issues
if: github.event.pull_request.merged == true
run: |
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
for ISSUE in $ISSUES
do
echo "Closing issue #$ISSUE"
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
-d '{"state":"closed"}'
done
- name: Close linked issues
if: github.event.pull_request.merged == true
run: |
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
for ISSUE in $ISSUES
do
echo "Closing issue #$ISSUE"
curl -X POST -H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
-d '{"body":"Closed by PR #${{ github.event.pull_request.number }}"}'
curl -X PATCH -H "Authorization: token ${{ secrets.TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
-d '{"state":"closed"}'
done
12 changes: 7 additions & 5 deletions .github/workflows/greetings.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Greetings

on: [pull_request_target, issues]
Expand All @@ -9,8 +11,8 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
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."
pr-message: "Welcome to Our repository.🎊 Thank you so much for taking the time to point this out."
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.TOKEN }}
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.'
pr-message: 'Welcome to Our repository.🎊 Thank you so much for taking the time to point this out.'
6 changes: 4 additions & 2 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: 'Greetings'

on:
Expand All @@ -16,9 +18,9 @@ jobs:
- uses: actions/checkout@v1
- uses: EddieHubCommunity/gh-action-community/src/welcome@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.TOKEN }}
issue-message: |
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!
pr-message: |
Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.
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)'
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)'
8 changes: 5 additions & 3 deletions .github/workflows/restrict_pr.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# @format

name: Restrict Contributor to limited contributions in Devlabs

on:
Expand All @@ -14,7 +16,7 @@ jobs:
id: calculate_score
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
github-token: ${{ secrets.TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
Expand Down Expand Up @@ -79,7 +81,7 @@ jobs:
if: always() && steps.calculate_score.outputs.close_pull_request == 'true'
uses: actions/github-script@v4
with:
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
github-token: ${{ secrets.TOKEN }}
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
Expand Down Expand Up @@ -110,4 +112,4 @@ jobs:
repo,
pull_number: pullRequestNumber,
state: 'closed'
});
});

0 comments on commit 98cad44

Please sign in to comment.