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
github
object model. This test is because the action checks outelastic/clients-flight-recorder
which is a private repo. So the condition should test that the user running the action is a member of theelastic
org. 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
secrets
context is not available and in consequence notoken/PAT
is supplied to thecheckout
action 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_owner
always evaluates to the BASE/target repository (elastic/elasticsearch-specification
in 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.flobernd
if 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
elastic
organization (e.g.elastic/elasticsearch-specification-clone
) might not have access to thesecrets
context. However there might be a special rule for "inside organization" forks that I don't remember right now.