This change adds a comment to the first PR from a new contributor that is merged, which tells them what to expect post merge from the build bots. How they will be notified, where to ask questions, that you're more likely to be reverted than in other projects, etc. The information overlaps with, and links to https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr. So that users who simply read the email are still aware, and know where to follow up if they do get reports. To do this, I have added a hidden HTML comment to the new contributor greeting comment. This workflow will look for that to tell if the author of the PR was a new contributor at the time they opened the merge. It has to be done this way because as soon as the PR is merged, they are by GitHub's definition no longer a new contributor and I suspect that their author association will be "contributor" instead. I cannot 100% confirm that without a whole lot of effort and probably breaking GitHub's terms of service, but it's fairly cheap to work around anyway. It seems rare / almost impossible to reopen a PR in llvm at least, but in case it does happen the buildbot info comment has its own hidden HTML comment. If we find this we will not post another copy of the same information.
42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
name: "Add buildbot information to first PRs from new contributors"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
# It's safe to use pull_request_target here, because we aren't checking out
|
|
# code from the pull request branch.
|
|
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
|
pull_request_target:
|
|
types:
|
|
- closed
|
|
|
|
jobs:
|
|
buildbot_comment:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
if: >-
|
|
(github.repository == 'llvm/llvm-project') &&
|
|
(github.event.pull_request.merged == true)
|
|
steps:
|
|
- name: Checkout Automation Script
|
|
uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: llvm/utils/git/
|
|
ref: main
|
|
|
|
- name: Setup Automation Script
|
|
working-directory: ./llvm/utils/git/
|
|
run: |
|
|
pip install -r requirements.txt
|
|
|
|
- name: Add Buildbot information comment
|
|
working-directory: ./llvm/utils/git/
|
|
run: |
|
|
python3 ./github-automation.py \
|
|
--token '${{ secrets.GITHUB_TOKEN }}' \
|
|
pr-buildbot-information \
|
|
--issue-number "${{ github.event.pull_request.number }}" \
|
|
--author "${{ github.event.pull_request.user.login }}"
|