From 5051b3be6e9fcbfeb95fb9e8fd547a827477a316 Mon Sep 17 00:00:00 2001 From: Bruno Capuano Date: Sun, 23 Feb 2025 13:25:12 -0500 Subject: [PATCH] Add workflows for welcoming issues and pull requests DETAILS Introduce GitHub Actions workflows for welcoming new issues and pull requests. Each workflow triggers on opening an issue or pull request, adds a "needs-review" label, and posts a thank-you comment to the author. Both workflows also auto-assign to the user `elbruno` using the `pozil/auto-assign-issue` action. --- .github/workflows/welcome-issue.yml | 34 +++++++++++++++++++++++++++++ .github/workflows/welcome-pr.yml | 34 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/welcome-issue.yml create mode 100644 .github/workflows/welcome-pr.yml diff --git a/.github/workflows/welcome-issue.yml b/.github/workflows/welcome-issue.yml new file mode 100644 index 00000000..9bc75754 --- /dev/null +++ b/.github/workflows/welcome-issue.yml @@ -0,0 +1,34 @@ +name: Welcome to the GenAINet +on: + # Trigger the workflow on new issue + issues: + types: [opened] +permissions: + contents: read + issues: write +jobs: + asses-issue: + runs-on: ubuntu-latest + steps: + - name: Add Label and thanks comment to Issue + uses: actions/github-script@v6 + with: + script: | + const issueAuthor = context.payload.sender.login + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['needs-review'] + }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `👋 Thanks for contributing @${ issueAuthor }! We will review the issue and get back to you soon.` + }) + - name: Auto-assign issue + uses: pozil/auto-assign-issue@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + assignees: elbruno \ No newline at end of file diff --git a/.github/workflows/welcome-pr.yml b/.github/workflows/welcome-pr.yml new file mode 100644 index 00000000..3e1574f2 --- /dev/null +++ b/.github/workflows/welcome-pr.yml @@ -0,0 +1,34 @@ +name: Welcome to the GenAINet +on: + # Trigger the workflow on pull request + pull_request_target: + types: [opened] +permissions: + contents: read + pull-requests: write +jobs: + asses-pull-request: + runs-on: ubuntu-latest + steps: + - name: Add Label and thanks comment to Pull request + uses: actions/github-script@v6 + with: + script: | + const issueAuthor = context.payload.sender.login + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['needs-review'] + }) + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `👋 Thanks for contributing @${ issueAuthor }! We will review the pull request and get back to you soon.` + }) + - name: Auto-assign issue + uses: pozil/auto-assign-issue@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + assignees: elbruno