Hi folks,
I have a workflow that runs periodically, precompiles a project, and uploades an image to GCR. The upload step requires secrets for GCR credentials, which are only entered in the settings of the main repository.
How can I check the name of the current repository and not run the workflow at all on repositories under different names (e.g., forks or copies of the repo not recognized as forks), so that the workflow does not fail every time?
My idea was to check for GITHUB_REPOSITORY
/github.repository
mathing the name of the main repo in an if
, but I cannot get the syntax right.
So far I tried:
- Adding
if: ${GITHUB_REPOSITORY} == 'base/repo'
at the workflow-level. - Same as above, but with
$GITHUB_REPOSITORY == 'base/repo'
,"$GITHUB_REPOSITORY" == 'base/repo'
,${{ GITHUB_REPOSITORY }} == 'base/repo'
, and${{ github.repository }} == 'base/repo'
. - Putting the same if but at each job step that can fail without secrets.
- Switching the order of if operands, i.e.,
'base/repo' == ...
.
but non of these seem to give valid workflow files. What’s the correct way to handle this?