Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with the
githubobject model. This test is because the action checks outelastic/clients-flight-recorderwhich is a private repo. So the condition should test that the user running the action is a member of theelasticorg. I don't think this is what this new expression will test?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. If the workflow is triggered from a fork, the
secretscontext is not available and in consequence notoken/PATis supplied to thecheckoutaction which ultimately causes the workflow to fail.The condition seems to be intended to work around that problem by disabling the workflow if it was triggered from a fork.
The expression used in the original condition however does not work for that purpose, because
github.repository_owneralways evaluates to the BASE/target repository (elastic/elasticsearch-specificationin this case). This for example happened in #2160.To check the HEAD/source branch instead, we have to use
github.event.pull_request.head.repo.owner.login. This expression would evaluate to e.g.floberndif I trigger this workflow from a fork (e.g.flobernd/elasticsearch-specification).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably this condition is still not the perfect one to use, because even a fork from inside the
elasticorganization (e.g.elastic/elasticsearch-specification-clone) might not have access to thesecretscontext. However there might be a special rule for "inside organization" forks that I don't remember right now.