Skip to content

Commit

Permalink
Fix MODULE_NOT_FOUND (#5)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
dekimsey authored Apr 17, 2023
1 parent 0aaee72 commit 5f2be72
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

name: test main integration
# This workflow validates the merged code functions exactly as an invoking workflow might use it.
# Due to the requiremnet that `uses` be a hard-coded value, we can only validate explicit git refs.
# In this case, we validate once a PR has been merged, main branch functions correctly

on:
pull_request:
types: [closed]

permissions:
contents: read

jobs:
main-merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: hashicorp/action-slack-status@main
with:
success-message: "Merge successfull"
status: ${{job.status
slack-webhook-url: ${{secrets.slack_webhook_url_feed_releng_test}}

2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ runs:
with:
# github-token: uncomment-this-line-for-local-act-testing
script: |
return require('./main.js')({context, core})
return require(process.env.GITHUB_ACTION_PATH + '/main.js')({context, core})
- name: Send Status
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0
env:
Expand Down

0 comments on commit 5f2be72

Please sign in to comment.