Trigger on label event
CiaranOMara opened this issue · comments
I'm reading through various benchmark workflows to get some ideas as to how to set up my own.
I think the comment below may no longer be true.
ImageContrastAdjustment.jl/benchmark/run_benchmarks.jl
Lines 6 to 7 in 5642b3a
Combining:
- https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsif
- https://help.github.com/en/actions/reference/events-that-trigger-workflows#label-event-label
- https://developer.github.com/webhooks/event-payloads/#label
I think a label trigger can be achieved with the following YAML adjustments.
on:
label:
types: [created, edited]
...
steps:
- name: Triggered by label
if: ${{ github.event_name == 'label' && github.event.label.name == 'run benchmark' }}
The label
event will only trigger a workflow run if the workflow file is on the master or default branch.
All totally untested of course.
Thank you very much for the suggestion. I haven't had time to really look into the benchmark stuff (I think Johnny set it up), but when I do I will check to see if I can incorporate your advice.
Closed by #37
@CiaranOMara The on-label events seem not to work as expected, see #35 and #36. Or did I miss something?
@johnnychen94, you've pushed me over the line to test my suggestion. I found that the on label event gets triggered when creating, editing, or deleting a label, which is not like the activity of labelling a pull request or issue. I think you captured that distinction with your solution - nice!