mirror of
https://github.com/intel/llvm.git
synced 2026-01-17 14:48:27 +08:00
[GitHub] Add greeting comment to opened PRs from new contributors (#72384)
This includes some commonly needed information like how to add reviewers. This is implemented as a job before the labeler, so that on a new PR the comment is added before there are any subscribers and only the author gets a nofitication. The labeler job depends on the greeter having run or having been skipped. So if the PR wasn't just opened, or it's from a regular contributor, the labeling still happens. But we can be sure that when a greeting comment is left, it's the very first thing we do.
This commit is contained in:
31
.github/workflows/new-prs.yml
vendored
31
.github/workflows/new-prs.yml
vendored
@@ -15,16 +15,43 @@ on:
|
||||
- synchronize
|
||||
|
||||
jobs:
|
||||
automate-prs-labels:
|
||||
greeter:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
# Only comment on PRs that have been opened for the first time, by someone
|
||||
# new to LLVM or to GitHub as a whole.
|
||||
if: >-
|
||||
(github.repository == 'llvm/llvm-project') &&
|
||||
(github.event.action == 'opened') &&
|
||||
(github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' ||
|
||||
github.event.pull_request.author_association == 'FIRST_TIMER')
|
||||
steps:
|
||||
- name: Setup Automation Script
|
||||
run: |
|
||||
curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/github-automation.py
|
||||
curl -O -L --fail https://raw.githubusercontent.com/"$GITHUB_REPOSITORY"/main/llvm/utils/git/requirements.txt
|
||||
chmod a+x github-automation.py
|
||||
pip install -r requirements.txt
|
||||
|
||||
- name: Greet Author
|
||||
run: |
|
||||
./github-automation.py \
|
||||
--token '${{ secrets.GITHUB_TOKEN }}' \
|
||||
pr-greeter \
|
||||
--issue-number "${{ github.event.pull_request.number }}"
|
||||
|
||||
automate-prs-labels:
|
||||
# Greet first so that only the author gets that notification.
|
||||
needs: greeter
|
||||
runs-on: ubuntu-latest
|
||||
# Ignore PRs with more than 10 commits. Pull requests with a lot of
|
||||
# commits tend to be accidents usually when someone made a mistake while trying
|
||||
# to rebase. We want to ignore these pull requests to avoid excessive
|
||||
# notifications.
|
||||
# always() means that even if greeter is skipped, this job will run.
|
||||
if: >
|
||||
github.repository == 'llvm/llvm-project' &&
|
||||
always() && github.repository == 'llvm/llvm-project' &&
|
||||
github.event.pull_request.draft == false &&
|
||||
github.event.pull_request.commits < 10
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user