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

[Feature] Add support for previous_sha and current_sha outputs #2371

Closed
2 tasks done
gm42 opened this issue Dec 4, 2024 · 5 comments
Closed
2 tasks done

[Feature] Add support for previous_sha and current_sha outputs #2371

gm42 opened this issue Dec 4, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@gm42
Copy link

gm42 commented Dec 4, 2024

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

Not related to a problem. I have seen that the action text output tells about which SHAs were used for the comparison:

Retrieving changes between b21edcea84825a0829e057c58fe245e6ca5a00df (main) → 92fbd4595dcaf9a1e2e92723247ce4f38a926817 (feat/my-branch)

This corresponds to this line of code: https://github.com/tj-actions/changed-files/blob/05f0aba931687dcad284e6c7f2e049c258a53fb8/src/main.ts#L131C46-L131C57

Describe the solution you'd like?

It would be great if I could extract these values via outputs, to re-use them in other steps.

Describe alternatives you've considered?

One can use ${{ github.event.pull_request.base.sha }} and ${{ github.event.pull_request.head.sha }} instead.

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gm42 gm42 added the enhancement New feature or request label Dec 4, 2024
@tj-actions-bot
Copy link
Contributor

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

@jackton1
Copy link
Member

Hi @gm42 , can you provide some more details about your use case?

@gm42
Copy link
Author

gm42 commented Dec 10, 2024

@jackton1 sure: one example is that after running this action one might want to put the used hashes in a text report telling about which files changed, or call git diff. I think it is necessary for composition with other actions which need a commit hash, in case one wants to also refer to the main branch commits.

@jackton1
Copy link
Member

jackton1 commented Dec 10, 2024

Hi @gm4, okay I’d suggest taking a look at https://github.com/nrwl/nx-set-shas which covers your use case. Since this action primary focus is to retrieve changed files.

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@gm42
Copy link
Author

gm42 commented Dec 13, 2024

Thanks for your answer; I disagree, that action is overkill for this and does not serve the purpose: this action is already deciding which commit SHAs to use, so by using a different action they could be different.

I will use a fork, no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants