From e60f1db6f0579558b0d02a39d0093f7ec1c1b3fb Mon Sep 17 00:00:00 2001 From: amiya Date: Tue, 29 Oct 2024 21:50:11 +0530 Subject: [PATCH] github workflow --- .github/workflows/greeting.yml | 16 ----------- .github/workflows/issue-open-close.yml | 29 +++++++++++++++++++ .github/workflows/pr-merge.yml | 35 +++++++++++++++++++++++ .github/workflows/pr-raise.yml | 39 ++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 16 deletions(-) delete mode 100644 .github/workflows/greeting.yml create mode 100644 .github/workflows/issue-open-close.yml create mode 100644 .github/workflows/pr-merge.yml create mode 100644 .github/workflows/pr-raise.yml diff --git a/.github/workflows/greeting.yml b/.github/workflows/greeting.yml deleted file mode 100644 index 3c7235c8..00000000 --- a/.github/workflows/greeting.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Greetings - -on: [pull_request_target, issues] - -jobs: - greeting: - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "πŸ‘‹ Thank you for raising an issue! We appreciate your effort in helping us improve. Our team will review it shortly. Stay tuned and support us by ⭐starring our repository!" - pr-message: " πŸŽ‰ Thank you for your contribution! Your pull request has been submitted successfully. A maintainer will review it as soon as possible. Support us by ⭐starring our repository!" diff --git a/.github/workflows/issue-open-close.yml b/.github/workflows/issue-open-close.yml new file mode 100644 index 00000000..eb27323f --- /dev/null +++ b/.github/workflows/issue-open-close.yml @@ -0,0 +1,29 @@ + +name: Issue Auto Comment +on: + issues: + types: [opened, closed] + +jobs: + comment: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Add a comment when an issue is opened + if: github.event.action == 'opened' + uses: actions-ecosystem/action-create-comment@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} + body: | + πŸ‘‹ Thanks for opening this issue! We appreciate your contribution. Please make sure you’ve provided all the necessary details and screenshots, and don't forget to follow our Guidelines and Code of Conduct. Happy coding! πŸš€ + + - name: Add a comment when an issue is closed + if: github.event.action == 'closed' + uses: actions-ecosystem/action-create-comment@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + number: ${{ github.event.issue.number }} + body: | + βœ… This issue has been successfully closed. Thank you for your contribution and helping us improve the project! If you have any more ideas or run into other issues, feel free to open a new one. Happy coding! πŸš€ diff --git a/.github/workflows/pr-merge.yml b/.github/workflows/pr-merge.yml new file mode 100644 index 00000000..5eea0cab --- /dev/null +++ b/.github/workflows/pr-merge.yml @@ -0,0 +1,35 @@ + +name: Merge Thank You + + + +on: + pull_request_target: + types: [closed] # Trigger when a PR is closed + +permissions: + issues: write + pull-requests: write + +jobs: + post_merge_message: + if: github.event.pull_request.merged == true # Only run if the PR was merged + runs-on: ubuntu-latest + + steps: + - name: Post thank you message + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} # Ensure token is used + script: | + const prNumber = context.payload.pull_request.number; + const owner = context.repo.owner; + const repo = context.repo.repo; + + // Post a thank you message upon PR merge + await github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: prNumber, + body: `πŸŽ‰πŸŽ‰ Thank you for your contribution! Your PR #${prNumber} has been merged! πŸŽ‰πŸŽ‰` + }); diff --git a/.github/workflows/pr-raise.yml b/.github/workflows/pr-raise.yml new file mode 100644 index 00000000..f7b1dc7b --- /dev/null +++ b/.github/workflows/pr-raise.yml @@ -0,0 +1,39 @@ + +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 <