From 7cc649b8546bc3d9dfa2fb606ad4dc948eaf52e9 Mon Sep 17 00:00:00 2001 From: MIGHTY1o1 Date: Fri, 25 Oct 2024 21:24:40 +0530 Subject: [PATCH 1/8] add auto commet on pr --- .github/workflows/auto_comment_on_pr.yml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/auto_comment_on_pr.yml diff --git a/.github/workflows/auto_comment_on_pr.yml b/.github/workflows/auto_comment_on_pr.yml new file mode 100644 index 0000000..817498a --- /dev/null +++ b/.github/workflows/auto_comment_on_pr.yml @@ -0,0 +1,36 @@ +name: Auto Comment on Issue + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + comment: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Add Comment to Issue + run: | + COMMENT=$(cat < Date: Fri, 25 Oct 2024 21:26:04 +0530 Subject: [PATCH 2/8] add auto commet on issue --- .../{auto_comment_on_pr.yml => auto_comment_on_issue.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{auto_comment_on_pr.yml => auto_comment_on_issue.yml} (100%) diff --git a/.github/workflows/auto_comment_on_pr.yml b/.github/workflows/auto_comment_on_issue.yml similarity index 100% rename from .github/workflows/auto_comment_on_pr.yml rename to .github/workflows/auto_comment_on_issue.yml From adefbef5818550cc4f62aac68ce9eb6a7fff45b7 Mon Sep 17 00:00:00 2001 From: MIGHTY1o1 Date: Fri, 25 Oct 2024 21:28:10 +0530 Subject: [PATCH 3/8] add auto comment on pr raise --- .github/workflows/auto_comment_pr_raise.yml | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/auto_comment_pr_raise.yml diff --git a/.github/workflows/auto_comment_pr_raise.yml b/.github/workflows/auto_comment_pr_raise.yml new file mode 100644 index 0000000..063c2d0 --- /dev/null +++ b/.github/workflows/auto_comment_pr_raise.yml @@ -0,0 +1,37 @@ +name: Auto Comment on PR + +on: + pull_request_target: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Add Comment to Pull Request + run: | + COMMENT=$(cat < Date: Fri, 25 Oct 2024 21:29:20 +0530 Subject: [PATCH 4/8] add auto comment on pr merge --- .github/workflows/auto_comment_pr_merge.yml | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/auto_comment_pr_merge.yml diff --git a/.github/workflows/auto_comment_pr_merge.yml b/.github/workflows/auto_comment_pr_merge.yml new file mode 100644 index 0000000..c4a075c --- /dev/null +++ b/.github/workflows/auto_comment_pr_merge.yml @@ -0,0 +1,36 @@ +name: Auto Comment on PR Merge + +on: + pull_request: + types: [closed] + +permissions: + issues: write + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + permissions: + pull-requests: write + if: github.event.pull_request.merged == true + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Add Comment to Issue + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + COMMENT=$(cat < Date: Fri, 25 Oct 2024 21:31:47 +0530 Subject: [PATCH 5/8] add auto label on issues --- .github/workflows/auto_lable_issue.yml | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/auto_lable_issue.yml diff --git a/.github/workflows/auto_lable_issue.yml b/.github/workflows/auto_lable_issue.yml new file mode 100644 index 0000000..4c850a6 --- /dev/null +++ b/.github/workflows/auto_lable_issue.yml @@ -0,0 +1,36 @@ +name: Auto Label Issue + +on: + issues: + types: [opened, reopened, edited] + +jobs: + label_issue: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Label Issue + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const issue = context.payload.issue; + const issueBody = issue.body ? issue.body.toLowerCase() : ''; + const issueTitle = issue.title.toLowerCase(); + + // Add gssoc label to all issues + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: ['gssoc-ext','hacktoberfest-accepted','hacktoberfest'] + }); + const addLabel = async (label) => { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: [label] + }); + }; \ No newline at end of file From c468fe0ecec85238f0f32128f93112ac7f126c91 Mon Sep 17 00:00:00 2001 From: MIGHTY1o1 Date: Fri, 25 Oct 2024 21:34:23 +0530 Subject: [PATCH 6/8] add auto label on raised pr --- .github/workflows/auto_label_pr.yml | 37 +++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/auto_label_pr.yml diff --git a/.github/workflows/auto_label_pr.yml b/.github/workflows/auto_label_pr.yml new file mode 100644 index 0000000..063c2d0 --- /dev/null +++ b/.github/workflows/auto_label_pr.yml @@ -0,0 +1,37 @@ +name: Auto Comment on PR + +on: + pull_request_target: + types: [opened] + +permissions: + issues: write + pull-requests: write + +jobs: + comment: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: Add Comment to Pull Request + run: | + COMMENT=$(cat < Date: Fri, 25 Oct 2024 21:35:54 +0530 Subject: [PATCH 7/8] add close issue on pr merge --- .github/workflows/close_issue_on_pr_merge.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/close_issue_on_pr_merge.yml diff --git a/.github/workflows/close_issue_on_pr_merge.yml b/.github/workflows/close_issue_on_pr_merge.yml new file mode 100644 index 0000000..3f681e3 --- /dev/null +++ b/.github/workflows/close_issue_on_pr_merge.yml @@ -0,0 +1,30 @@ +name: Close Issues on PR Merge + +on: + pull_request: + types: [closed] + +jobs: + close-issues: + runs-on: ubuntu-latest + + steps: + - 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 \ No newline at end of file From 4ae6785347ed51f687bdf101e85526d31c0f2f6e Mon Sep 17 00:00:00 2001 From: MIGHTY1o1 Date: Fri, 25 Oct 2024 21:37:25 +0530 Subject: [PATCH 8/8] add comment issue close --- .github/workflows/comment_iss-close.yml | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/comment_iss-close.yml diff --git a/.github/workflows/comment_iss-close.yml b/.github/workflows/comment_iss-close.yml new file mode 100644 index 0000000..7c943e0 --- /dev/null +++ b/.github/workflows/comment_iss-close.yml @@ -0,0 +1,29 @@ +name: Comment on Issue Close + +on: + issues: + types: [closed] + +jobs: + greet-on-close: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Greet User + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const issue = context.payload.issue; + const issueCreator = issue.user.login; + const issueNumber = issue.number; + + const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: greetingMessage + }); \ No newline at end of file