-
Notifications
You must be signed in to change notification settings - Fork 173
Open
Labels
github_actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions code
Description
It will be a great idea to add a workflow that checks the PRs
GitHub Actions workflow that automates the review process for pull requests (PRs) in our repository. The workflow will:
- Check the PRs to determine if they are dev related or not. (based on some keyword or some parameters)
- Automatically label the PRs as
dev-relatedornon-dev-related. - Notify the maintainers when a dev-related PR is submitted for prompt review.
- Sent/suggest a message if they are not dev related.
Workflow Details
Trigger
- The workflow will trigger on the following pull request events:
opened,edited,reopened.
Steps
- Checkout Code: Use
actions/checkout@v2to check out the repository code. - Keyword Check: Run a script to check the PR title and description for specific dev-related keywords (e.g.,
dev,developer,frontend,backend,fullstack,programming,code). - Add Label: Use
actions-ecosystem/action-add-labels@v1to add a label (dev-relatedornon-dev-related) based on the keyword check result. - Notify Maintainers: If the PR is dev-related, send a notification comment to the PR to inform the maintainers for prompt review.
Example Workflow Configuration
name: PR Check
on:
pull_request:
types: [opened, edited, reopened]
jobs:
check-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check for dev-related keywords
id: keyword-check
run: |
keywords="dev,developer,frontend,backend,fullstack,programming,code"
if echo "${{ github.event.pull_request.title }} ${{ github.event.pull_request.body }}" | grep -iE "$keywords"; then
echo "::set-output name=is-dev-related::true"
else
echo "::set-output name=is-dev-related::false"
fi
- name: Add label based on keyword check
uses: actions-ecosystem/action-add-labels@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ steps.keyword-check.outputs.is-dev-related == 'true' && 'dev-related' || 'non-dev-related' }}
- name: Notify maintainers
if: steps.keyword-check.outputs.is-dev-related == 'true'
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d '{"body": "A new dev-related PR has been submitted. Please review it at your earliest convenience."}' \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
github_actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions code