Reputation: 40541
on:
push:
branches:
- main
- 'releases/**'
The above is from the documents here: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#using-filters
Is it possible to include env
in this area? And example like the following:
on:
push:
branches:
- main
env: // <-- this
TOKEN: token-on-push-on-main
pull_request:
branches:
- main
env: // <-- and this
TOKEN: token-on-pull-request-on-main
Upvotes: 0
Views: 53
Reputation: 19852
No, it's impossible to do it like this.
But you can add a step that will identify the trigger, by checking if ${{ github.event_name }}
is pull_request
or push
and based on that set env value.
One example will be:
env:
TOKEN: "${{ github.event_name == 'push' && 'token-on-push-on-main' || 'token-on-pull-request-on-main' }}"
Upvotes: 1