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] Specify base branch, not just base-sha #941

Closed
2 tasks done
djfinnoy opened this issue Jan 10, 2023 · 4 comments
Closed
2 tasks done

[Feature] Specify base branch, not just base-sha #941

djfinnoy opened this issue Jan 10, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@djfinnoy
Copy link

Is this feature missing in the latest version?

  • I'm using the latest release

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

I want the base-sha option to poin to the latest commit in the base branch:

      - id: changed-files
        uses: tj-actions/changed-files@3b6c057cd82d1dafab565df2ba9fa489574a03b8  # v34.6.1
        with:
          sha: ${{ github.event.pull_request.head.sha }}
          base_sha: ${{ github.event.pull_request.base.sha }}

However, there is a problem with Github Actions where github.event.pull_request.base.sha does not necessarily refer to the latest commit of the base branch: community/community#39880

Describe the solution you'd like?

It would be super great if this tool supported a base-branch option, instead of relying on the user to figure out the correct sha for the base branch.

Describe alternatives you've considered?

Wait for GitHub to fix github.event.pull_request.base.sha

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@djfinnoy djfinnoy added the enhancement New feature or request label Jan 10, 2023
@github-actions
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

jackton1 commented Jan 10, 2023

@djfinnoy I believe you can omit both sha and base_sha inputs since they are automatically determined, this also includes the base branch.

The action relies on running a diff with the sha instead of branch names which provides more control.

I also noticed that you aren't using the latest version you might want to upgrade to resolve any bugs you might have been experiencing.

See the usage section for more information.

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2023
@djfinnoy
Copy link
Author

My apologies, I failed to understand my own code from a few months ago.

github.event.pull_request.base.sha intentionally refers to the commit sha of the base branch, as it was when the PR was created. There is no problem here. If I omit both, I would be comparing against the latest version of the base branch, as you said.

@jackton1
Copy link
Member

Yes that's correct

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

2 participants