From d727de53b744ce00600337562a47fbb9f9d5f4fb Mon Sep 17 00:00:00 2001 From: "HanuCh@udhary" <137854084+hanuchaudhary@users.noreply.github.com> Date: Sat, 4 Jan 2025 15:01:14 +0530 Subject: [PATCH] added workflows --- .github/workflows/autoComment.yaml | 29 ++++++++++++++++++++++ .github/workflows/newContibuter.yaml | 36 ++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/autoComment.yaml create mode 100644 .github/workflows/newContibuter.yaml diff --git a/.github/workflows/autoComment.yaml b/.github/workflows/autoComment.yaml new file mode 100644 index 0000000..0658fa8 --- /dev/null +++ b/.github/workflows/autoComment.yaml @@ -0,0 +1,29 @@ +name: Auto Comment on Issues and PRs + +on: + issues: + types: [opened] + pull_request: + types: [opened] + +jobs: + auto-comment: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - name: Auto Comment + uses: actions/github-script@v7 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + const issueComment = context.payload.issue + ? `Thank you for opening an issue, @${context.payload.issue.user.login}! We'll review it soon.` + : `Thank you for creating this pull request, @${context.payload.pull_request.user.login}! A reviewer will check it shortly.`; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: issueComment, + }); diff --git a/.github/workflows/newContibuter.yaml b/.github/workflows/newContibuter.yaml new file mode 100644 index 0000000..f8d5f97 --- /dev/null +++ b/.github/workflows/newContibuter.yaml @@ -0,0 +1,36 @@ +name: First Time Contributer +on: pull_request_target + +jobs: + welcome: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const creator = context.payload.sender.login + const opts = github.rest.issues.listForRepo.endpoint.merge({ + ...context.issue, + creator, + state: 'all' + }) + const issues = await github.paginate(opts) + + for (const issue of issues) { + if (issue.number === context.issue.number) { + continue + } + + if (issue.pull_request) { + return + } + } + + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `**Welcome**, new contributor! + + Please make sure you've read our [Contributing Guide](README.md) and we look forward to reviewing your Pull request shortly ✨` + })