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

Allow user-defined pull request number #365

Closed
xli12 opened this issue May 27, 2024 · 6 comments
Closed

Allow user-defined pull request number #365

xli12 opened this issue May 27, 2024 · 6 comments

Comments

@xli12
Copy link
Contributor

xli12 commented May 27, 2024

Hi,

We are using this Github Action to report the test coverage in our pipeline. However, the actions are not always triggered by pull_request, but push instead. As a result, in the context there is no pull request number:

let pullRequestNumber = github.context.payload.pull_request?.number;

Therefore a user-defined pull request number as an input would be helpful (suppose the prNumber is given by the user):

let pullRequestNumber = github.context.payload.pull_request?.number || prNumber;

There are other test coverage GitHub Actions which allow this, for example https://github.com/ArtiomTr/jest-coverage-report-action/tree/main.

I could also submit a pull request if needed.

@davelosert
Copy link
Owner

Hey @xli12,

thank you for opening up the issue!

Definitely something I would like to support, and I would welcome a PR for this very much! 👍

@xli12
Copy link
Contributor Author

xli12 commented May 29, 2024

Hi @davelosert ,

Thank you for your quick reply! A pull request #369 has been submitted. Please let me know if you have further questions.

@davelosert
Copy link
Owner

@xli12: I just merged the PR and this feature got released in version 2.4.0.
Feel free to chime in here and let me know if it works as expected, then we can close the issue.

Thank you again for contributing! ❤

@xli12
Copy link
Contributor Author

xli12 commented Jun 12, 2024

@davelosert Thank you for all the assistance with this feature. Just tested using the latest version v2.4.0 in our repository, it works really well 👍

Screenshot 2024-06-12 at 10 09 38 Screenshot 2024-06-12 at 10 10 42

@davelosert
Copy link
Owner

@xli12 : Thank you so much for the feedback - glad to see it works and already provides value to you! ❤

I will close this issue then!

@davelosert
Copy link
Owner

@xli12: Coming back here - I've just released v2.6.0 of this action with a feature with this action that allows you to set the pr-number: "auto", which will automatically try to find a pull-request associated with the latest head-sha of the commit on a push event. Maybe this is helpful for you, too?

I guess you have some intermediate action right now that would do the same that you potentially could remove then. Let me know if it's useful and works for you! :)

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

No branches or pull requests

2 participants