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

feat: set pullRequestNumber as action output #167

Merged
merged 4 commits into from
Apr 7, 2022

Conversation

dmregister
Copy link
Contributor

@dmregister dmregister commented Apr 5, 2022

Closes: #82

@changeset-bot
Copy link

changeset-bot bot commented Apr 5, 2022

🦋 Changeset detected

Latest commit: 0db863f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/action Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

src/run.ts Outdated Show resolved Hide resolved
script: getOptionalInput("version"),
githubToken,
prTitle: getOptionalInput("title"),
commitMessage: getOptionalInput("commit"),
hasPublishScript,
});

core.setOutput("pullRequestNumber", String(pullRequestNumber));
Copy link
Member

Choose a reason for hiding this comment

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

Since this will always be int - could we not cast it with String()? Would it have any observable difference if this wouldn't be casted? Like perhaps one version would not be quoted or smth? Did you test this from the consumer's side of this action?

I've checked the source code of @actions/core and I think this gets stringified anyway but it would be great if we could confirm if there is any practical difference between both flavours - if there is not then I'm ok with leaving it as is.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I've just checked this locally and both are equivalent:
Screenshot 2022-04-06 at 11 03 42

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it for a couple reasons:

  1. like you said, it's always coerced into a string under the hood and I think everything needs to be a string
  2. to control the type of output to make it consistent, regardless of what actions does under the hood

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
@Andarist Andarist merged commit 993a0a0 into changesets:main Apr 7, 2022
@github-actions github-actions bot mentioned this pull request Apr 7, 2022
@dmregister dmregister deleted the feat/pr-number-output branch April 7, 2022 17:15
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.

Include pull request number in action output
2 participants