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.
Description
By default the working directory of the composite action is the calling workflows's context. This means a relative require like what was done here isn't reading the action's embedded main.js but instead trying to read main.js in the caller's workflow.
This presented as an error message like such:
This wasn't caught during testing because GHA requires one to check the testing repo out before being able to run a local action. This masked the behavior as our checkout directory was always the same as the action we were testing.
I believe it was missed in the integration tests because those were tested when the main.js content was embedded in the action.yml.
Resolution
uses
, so we execute against main after a PR is closed. This allows us to validate the action will work in the exact same way our calling workflows might use it.Note:
github.action_path
would be the correct Node variable to retrieve the action's source directory, but there's discussion about this being broken for the moment. Instead we'll useprocess.env.GITHUB_ACTION_PATH
, until actions/runner#2517 is fixed.