From 1859f94181cef56d79508c5dd523933d4675b9df Mon Sep 17 00:00:00 2001 From: Nick Fields <46869826+nick-fields@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:44:00 -0400 Subject: [PATCH 1/4] patch: run workflow on PR into default branch only (#119) --- .github/workflows/ci_cd.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 178e545..740a156 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1,12 +1,13 @@ name: CI/CD on: - push: + # only on PRs into default branch + pull_request: + branches: + - master jobs: - # runs on branch pushes only ci_unit: name: Run Unit Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -26,7 +27,6 @@ jobs: ci_integration: name: Run Integration Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -137,7 +137,6 @@ jobs: ci_integration_envvar: name: Run Integration Env Var Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -159,7 +158,6 @@ jobs: ci_integration_large_output: name: Run Integration Large Output Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -191,7 +189,6 @@ jobs: ci_integration_retry_on_exit_code: name: Run Integration retry_on_exit_code Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -240,7 +237,6 @@ jobs: ci_integration_continue_on_error: name: Run Integration continue_on_error Tests - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -288,7 +284,6 @@ jobs: ci_integration_retry_wait_seconds: name: Run Integration Tests (retry_wait_seconds) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -325,7 +320,6 @@ jobs: ci_integration_on_retry_cmd: name: Run Integration Tests (on_retry_command) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -369,7 +363,6 @@ jobs: # timeout tests take longer to run so run in parallel ci_integration_timeout_seconds: name: Run Integration Timeout Tests (seconds) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -400,7 +393,6 @@ jobs: ci_integration_timeout_retry_on_timeout: name: Run Integration Timeout Tests (retry_on timeout) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -432,7 +424,6 @@ jobs: ci_integration_timeout_retry_on_error: name: Run Integration Timeout Tests (retry_on error) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -468,7 +459,6 @@ jobs: ci_integration_timeout_minutes: name: Run Integration Timeout Tests (minutes) - if: startsWith(github.ref, 'refs/heads') runs-on: ubuntu-latest steps: - name: Checkout @@ -499,7 +489,6 @@ jobs: ci_windows: name: Run Windows Tests - if: startsWith(github.ref, 'refs/heads') runs-on: windows-latest steps: - name: Checkout @@ -571,7 +560,7 @@ jobs: steps: - run: echo "If this is hit, all tests successfully passed" - # runs on push to master only + # runs on merge to master only cd: name: Publish Action needs: [ci_all_tests_passed] From 1d41e5db1a8743123f4dbfc2b2efd8f2f7a3d0d9 Mon Sep 17 00:00:00 2001 From: Nick Fields <46869826+nick-fields@users.noreply.github.com> Date: Tue, 26 Sep 2023 09:49:59 -0400 Subject: [PATCH 2/4] patch: also run workflow on merge to default --- .github/workflows/ci_cd.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 740a156..f6ac55c 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -1,9 +1,12 @@ name: CI/CD on: - # only on PRs into default branch + # only on PRs into and merge to default branch pull_request: branches: - master + push: + branches: + - master jobs: ci_unit: @@ -560,7 +563,7 @@ jobs: steps: - run: echo "If this is hit, all tests successfully passed" - # runs on merge to master only + # runs on merge to default only cd: name: Publish Action needs: [ci_all_tests_passed] From 1139f998efa3c95010eff603a0d9ff0cfa444788 Mon Sep 17 00:00:00 2001 From: Unai Recio Date: Tue, 26 Sep 2023 15:56:58 +0200 Subject: [PATCH 3/4] feat(shell): checks only the shell name and allows any argument (#118) Co-authored-by: ureciocais Co-authored-by: Nick Fields <46869826+nick-fields@users.noreply.github.com> --- dist/index.js | 11 ++++++----- src/index.ts | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index c5029cb..f2bb3df 100644 --- a/dist/index.js +++ b/dist/index.js @@ -948,7 +948,8 @@ function getExecutable(inputs) { return OS === 'win32' ? 'powershell' : 'bash'; } var executable; - switch (inputs.shell) { + var shellName = inputs.shell.split(' ')[0]; + switch (shellName) { case 'bash': case 'python': case 'pwsh': { @@ -957,7 +958,7 @@ function getExecutable(inputs) { } case 'sh': { if (OS === 'win32') { - throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS)); + throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS)); } executable = inputs.shell; break; @@ -965,13 +966,13 @@ function getExecutable(inputs) { case 'cmd': case 'powershell': { if (OS !== 'win32') { - throw new Error("Shell ".concat(inputs.shell, " not allowed on OS ").concat(OS)); + throw new Error("Shell ".concat(shellName, " not allowed on OS ").concat(OS)); } - executable = inputs.shell + '.exe'; + executable = shellName + '.exe' + inputs.shell.replace(shellName, ''); break; } default: { - throw new Error("Shell ".concat(inputs.shell, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells")); + throw new Error("Shell ".concat(shellName, " not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells")); } } return executable; diff --git a/src/index.ts b/src/index.ts index f443451..aa5642e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,7 +20,9 @@ function getExecutable(inputs: Inputs): string { } let executable: string; - switch (inputs.shell) { + const shellName = inputs.shell.split(' ')[0]; + + switch (shellName) { case 'bash': case 'python': case 'pwsh': { @@ -29,7 +31,7 @@ function getExecutable(inputs: Inputs): string { } case 'sh': { if (OS === 'win32') { - throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`); + throw new Error(`Shell ${shellName} not allowed on OS ${OS}`); } executable = inputs.shell; break; @@ -37,14 +39,14 @@ function getExecutable(inputs: Inputs): string { case 'cmd': case 'powershell': { if (OS !== 'win32') { - throw new Error(`Shell ${inputs.shell} not allowed on OS ${OS}`); + throw new Error(`Shell ${shellName} not allowed on OS ${OS}`); } - executable = inputs.shell + '.exe'; + executable = shellName + '.exe' + inputs.shell.replace(shellName, ''); break; } default: { throw new Error( - `Shell ${inputs.shell} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells` + `Shell ${shellName} not supported. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell for supported shells` ); } } From 14672906e672a08bd6eeb15720e9ed3ce869cdd4 Mon Sep 17 00:00:00 2001 From: Nick Fields <46869826+nick-fields@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:05:30 -0400 Subject: [PATCH 4/4] minor: bump sem-rel action to v4 to fix esm errors --- .github/workflows/ci_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f6ac55c..b51519b 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -580,7 +580,7 @@ jobs: run: npm ci - name: Release id: semantic - uses: cycjimmy/semantic-release-action@v2 + uses: cycjimmy/semantic-release-action@v4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Tag