From 3bca8616376c476c685f46d8f3dc365bf6ea7240 Mon Sep 17 00:00:00 2001 From: Flook Peter Date: Mon, 24 Jun 2024 20:00:18 +0800 Subject: [PATCH] Check for environment variable before checking GitHub input --- action.yml | 5 +++-- src/main.js | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 8ffa974ed..2ac61431a 100644 --- a/action.yml +++ b/action.yml @@ -28,8 +28,9 @@ runs: - name: Run integration tests uses: actions/github-script@v7 with: - configuration-file: ${{ inputs.configuration-file }} - insta-infra-folder: ${{ inputs.insta-infra-folder }} script: | const script = require("${{github.action_path}}/dist/index.js") script({core}) + env: + CONFIGURATION_FILE: ${{ inputs.configuration-file }} + INSTA_INFRA_FOLDER: ${{ inputs.insta-infra-folder }} diff --git a/src/main.js b/src/main.js index ad21fca87..f7031358e 100644 --- a/src/main.js +++ b/src/main.js @@ -11,8 +11,12 @@ const execSync = require('child_process').execSync */ async function run() { try { - const configFile = core.getInput('configuration-file', {}) - const instaInfraFolder = core.getInput('insta-infra-folder', {}) + const configFile = process.env.CONFIGURATION_FILE + ? process.env.CONFIGURATION_FILE + : core.getInput('configuration-file', {}) + const instaInfraFolder = process.env.INSTA_INFRA_FOLDER + ? process.env.INSTA_INFRA_FOLDER + : core.getInput('insta-infra-folder', {}) // Debug logs are only output if the `ACTIONS_STEP_DEBUG` secret is true core.debug(`Using config file: ${configFile}`)