Setting "env" on the "on" field in a GitHub Workflow

Viewed 18
1 Answers

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' }}"
Related