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

Add the ability to overwrite sha and ref #52

Closed
wants to merge 16 commits into from

Conversation

jmservera
Copy link

When there's a PR from a fork and we want to compare the tree to the base with this action, this action needs write permission into the repo, but this is only allowed from PRs within the repo. To have the write rights you can use a pull_request_target event, that will run in the base context and will give the action the right permissions when the user has it.
In such a case, the sha and ref values are from the base branch and not from the current PR, so we need to provide a way to overwrite these values too.

To allow this I modified this:

  • check if there are values inside the ref and sha inputs.
  • modify the github.context with the provided values, and empty the eventName field to ensure that the Snapshot takes the provided ones.
  • send the context as a parameter inside the SnapshotConfig.

fixes: #51

@jmservera
Copy link
Author

Closing as the solution proposed in ff23df9 seems cleaner.

@jmservera jmservera closed this Oct 31, 2023
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.

Need to specify ref and sha when running a pull request from a fork with pull_request_target
1 participant