Account for Forked PRs + refactor testing #45
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Overview
This PR includes necessary updated for getting the merge action to work for forked PRs. When this action runs on
pull_request
events for forked PRs, the action will not have access to any secrets, most likely including the trunk token necessary for this action to work. To account for this, thesetImpactedTargets
API allows for uploading impacted targets using the github workflow run ID of the job that is uploading impacted targets. If the provided ID belongs to an in-progress run from a forked PR, and the SHA within the request matches that SHA of that workflow run ID, then the upload will be allowedThis PR handles the above, making it so that if the workflow is coming from a fork, we properly make the
setImpactedTargets
API call using the forked workflow run IDChanges to how this action is used
None
Testing
I added tests verifying the new conditions around not always needing the API token. Additionally, I refactored the tests to make future changes like this easier
Other changes