diff --git a/internal/fod-login/action.yml b/internal/fod-login/action.yml index 82a3275..4e8963d 100644 --- a/internal/fod-login/action.yml +++ b/internal/fod-login/action.yml @@ -11,8 +11,8 @@ runs: if: ${{ !env._FOD_LOGGED_IN }} with: dir: ${{ github.action_path }} - script: ./fod-login.sh - post: ./fod-logout.sh + script: fod-login.sh + post: fod-logout.sh branding: icon: 'shield' diff --git a/internal/run-script-js/main.js b/internal/run-script-js/main.js deleted file mode 100644 index 57d111c..0000000 --- a/internal/run-script-js/main.js +++ /dev/null @@ -1,24 +0,0 @@ -const { spawn } = require("child_process"); -const { appendFileSync } = require("fs"); -const { EOL } = require("os"); - -function run(script) { - if ( script ) { - const dir = process.env.INPUT_DIR; - const utilDir = process.env.INPUT_UTIL; - const subprocess = spawn(`bash -c -o pipefail -v 'export UTIL_DIR=${utilDir}; ${dir}/${script}'`, - { stdio: "inherit", shell: true }); - subprocess.on("exit", (exitCode) => { - process.exitCode = exitCode; - }); - } -} - -const key = process.env.INPUT_KEY.toUpperCase(); - -if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step? - run(process.env.INPUT_POST); -} else { // Otherwise, this is the main step - appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`); - run(process.env.INPUT_SCRIPT); -} diff --git a/internal/run-script/README.md b/internal/run-script/README.md new file mode 100644 index 0000000..cfd3537 --- /dev/null +++ b/internal/run-script/README.md @@ -0,0 +1,34 @@ +# fortify/github-action/internal/run-script + +This action can run any of the scripts located in the `scripts` directory of this action, including the ability to run post-job scripts, for example to handle session logout. + +```yaml + - uses: fortify/github-action/internal/run-script@v1 + with: + script: