Let's consider a GitHub Actions workflow like this (based on this one):
name: CI
'on':
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
lint:
...
unit-test:
...
Currently, this workflow is triggered on every commit, no matter which user authored the commit.
Would it be possible to configure the workflow so it gets triggered only when the author is not a given one (i.e. user1
)? How?
Thanks to @jonrsharpe's feedback I have fixed the workflow this way:
name: CI
'on':
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
lint:
if: github.actor != 'user1'
runs-on: ubuntu-latest
...
unit-test:
if: github.actor != 'user1'
runs-on: ubuntu-latest
...
It is not optimal (as the if
clause has to be repeated in every job) but suffices for my case.