Skip to content

Commit

Permalink
Add default shell settings for action scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yorifuji committed Dec 15, 2024
1 parent 4fa90e4 commit 0c28a2d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
7 changes: 5 additions & 2 deletions actual/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ inputs:
description: "Cache key for actual"
required: true

defaults:
run:
shell: bash -euo pipefail {0}

runs:
using: composite
steps:
- shell: bash
run: |
- run: |
if [ -e .easy-vrt ]; then exit 1; fi
mkdir .easy-vrt && mv ${{ inputs.actual-dir }} .easy-vrt/actual
Expand Down
19 changes: 9 additions & 10 deletions compare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ inputs:
required: false
default: false

defaults:
run:
shell: bash -euo pipefail {0}

runs:
using: composite
steps:
- shell: bash
run: |
- run: |
echo expected-cache-key ${{ inputs.expected-cache-key }}
echo actual-cache-key ${{ inputs.actual-cache-key }}
- shell: bash
run: |
- run: |
if [ -e .easy-vrt ]; then exit 1; fi
- shell: bash
run: |
- run: |
if [ -e package.json ]; then exit 1; fi
if [ -e package-lock.json ]; then exit 1; fi
cp $GITHUB_ACTION_PATH/package.json $GITHUB_ACTION_PATH/package-lock.json .
Expand All @@ -47,8 +48,7 @@ runs:
node-version: 20
cache: npm

- shell: bash
run: npm install
- run: npm install

- uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
Expand All @@ -60,8 +60,7 @@ runs:
key: reg-suit-cache-${{ inputs.expected-cache-key }}
path: .easy-vrt/expected

- shell: bash
run: >
- run: >
npx reg-cli
.easy-vrt/actual
.easy-vrt/expected
Expand Down
7 changes: 5 additions & 2 deletions expected/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ inputs:
description: "Cache key for expected"
required: true

defaults:
run:
shell: bash -euo pipefail {0}

runs:
using: composite
steps:
# expected

- shell: bash
run: |
- run: |
if [ -e .easy-vrt ]; then exit 1; fi
mkdir .easy-vrt && mv ${{ inputs.expected-dir }} .easy-vrt/expected
Expand Down
5 changes: 4 additions & 1 deletion prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ outputs:
description: "Whether the expected cache was found"
value: ${{ steps.lookup-expected-cache.outputs.cache-hit }}

defaults:
run:
shell: bash -euo pipefail {0}

runs:
using: composite
steps:
Expand All @@ -30,7 +34,6 @@ runs:
fetch-depth: 0

- id: lookup-sha
shell: bash
run: |
echo "actual-sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
echo "expected-sha=$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 0c28a2d

Please sign in to comment.