Skip to content

Commit 5f2be72

Browse files
authored
Fix MODULE_NOT_FOUND (#5)
* Fix MODULE_NOT_FOUND 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 main.yml. 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. I believe it was missed in the integration tests because those were tested when the main.js was _embedded_ in the action.yml. Hilarious. * Add an on-merge test case
1 parent 0aaee72 commit 5f2be72

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: MPL-2.0
3+
4+
name: test main integration
5+
# This workflow validates the merged code functions exactly as an invoking workflow might use it.
6+
# Due to the requiremnet that `uses` be a hard-coded value, we can only validate explicit git refs.
7+
# In this case, we validate once a PR has been merged, main branch functions correctly
8+
9+
on:
10+
pull_request:
11+
types: [closed]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
main-merge:
18+
runs-on: ubuntu-latest
19+
if: github.event.pull_request.merged == true
20+
steps:
21+
- uses: hashicorp/action-slack-status@main
22+
with:
23+
success-message: "Merge successfull"
24+
status: ${{job.status
25+
slack-webhook-url: ${{secrets.slack_webhook_url_feed_releng_test}}
26+

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ runs:
4545
with:
4646
# github-token: uncomment-this-line-for-local-act-testing
4747
script: |
48-
return require('./main.js')({context, core})
48+
return require(process.env.GITHUB_ACTION_PATH + '/main.js')({context, core})
4949
- name: Send Status
5050
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
5151
env:

0 commit comments

Comments
 (0)