Skip to content

Commit

Permalink
Prevent overrides of SHELLOPTS.
Browse files Browse the repository at this point in the history
  • Loading branch information
awalsh128 committed Mar 3, 2024
1 parent a6c3917 commit b0cd299
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ outputs:
runs:
using: "composite"
steps:
- id: env-setup
shell: bash
# Don't fail on error but respect pre-action env vars.
# We use the exit status as a conditional in lib.sh.
# This is the default behavior but can be overriden by the caller in the SHELLOPTS env var.
run: |
OLDOPTS=$(set +o)
case $- in
*e*) OLDOPTS="$OLDOPTS; set -e";;
*) OLDOPTS="$OLDOPTS; set +e";;
esac
echo "CACHE_APT_PKGS_OLD_OPTS=$(cat $OLDOPTS)" >> $GITHUB_ENV
set +e
- id: pre-cache
run: |
${GITHUB_ACTION_PATH}/pre_cache_action.sh \
Expand Down Expand Up @@ -101,3 +114,8 @@ runs:
run: |
rm -rf ~/cache-apt-pkgs
shell: bash

- id: env-teardown
shell: bash
run: |
eval $(cat $CACHE_APT_PKGS_OLD_OPTS)

0 comments on commit b0cd299

Please sign in to comment.