Saichovsky
01/17/2024, 10:41 PMpush to the master branch (when PRs get merged to master, I believe)
I would like to add a couple of jobs that will run if the PR that just got merged to master had certain labels. The push event does not have a labels attribute, but the pull_request event does.
I’m now wondering: is
on:
push:
branches:
- master # commits to master I believe
equivalent to:
on:
pull_request:
branches:
- master
types: ["closed"] # I suspect that this would also be the same as the above commit to master. We auto-close PRs upon merging to master
If these two triggers are identical logically, then I can change the PR trigger from the former to the latter without breaking the existing jobs. I just want to be sure that it won’t break. If the two triggers are not logically similar, someone please explain to me how I can achieve what I am trying to without breaking the other older, existing jobs
Thanks in advanceDan Miller (Cloud Posse)
01/18/2024, 12:20 AMpull_request trigger and then check if the label is included in the job itself. For example:
on:
pull_request:
types:
- closed
branches:
- main
jobs:
foo:
if: ${{ github.event.pull_request.merged && !contains( github.event.pull_request.labels.*.name, 'mylabel') }}Dan Miller (Cloud Posse)
01/18/2024, 12:23 AMSaichovsky
01/18/2024, 8:43 AM