Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the PR number artifact when triggered from a comment. #133

Merged
merged 1 commit into from
May 17, 2024

Conversation

plietar
Copy link
Contributor

@plietar plietar commented May 16, 2024

The receive action was storing github.event.number as an artefact for the comment action to use. However, this field is only set for pull request events. If the workflow is configured to trigger on a comment, the event type is now issue_comment as the field is absent.

There is an equivalent field at github.event.issue.number, but that field is absent for PR events. The easiest way to get the number in a uniform and consistent way is to use the PR metadata we already have at the start of the action.

The receive action was storing `github.event.number` as an artefact for
the comment action to use. However, this field is only set for pull
request events. If the workflow is configured to trigger on a comment,
the event type is now `issue_comment` as the field is absent.

There is an equivalent field at `github.event.issue.number`, but that
field is absent for PR events. The easiest way to get the number in a
uniform and consistent way is to use the PR metadata we already have at
the start of the action.
@lorenzwalthert
Copy link
Owner

Thanks. @assignUser do you agree? I lack the competence to approve this PR.

Copy link
Collaborator

@assignUser assignUser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, makes sense, thanks for the fix! The inconsistency of github.event.number being set or not is always annoying...

@lorenzwalthert lorenzwalthert merged commit 27004bb into lorenzwalthert:main May 17, 2024
6 checks passed
@lorenzwalthert
Copy link
Owner

Thanks to both.

@plietar plietar deleted the fix-number branch May 17, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants