Skip to content

Commit

Permalink
init-pants: Only use CI config file if it exists (#13)
Browse files Browse the repository at this point in the history
Avoids manipulating any custom value for input.pants-config-files.
If DEFAULT, then set PANTS_CONFIG_FILES=pants.ci.toml if pants.ci.toml exists.
Setting input.pants-config-files='' still bypasses setting the env var.
  • Loading branch information
cognifloyd authored Dec 2, 2022
1 parent 5f8f24e commit 615843b
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions init-pants/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ inputs:
# should be a hash generated by hashFiles()
pants-ci-config:
required: false
default: pants.ci.toml
default: DEFAULT
# defaults to pants.ci.toml if present
# set to empty string to disable
cache-lmdb-store:
required: false
Expand Down Expand Up @@ -105,8 +106,20 @@ runs:
- name: Tell pants to use CI config
if: ${{ inputs.pants-ci-config != '' }}
shell: bash
env:
PANTS_CONFIG_FILES: ${{ inputs.pants-ci-config }}
run: |
echo "PANTS_CONFIG_FILES=${{ inputs.pants-ci-config }}" >> ${GITHUB_ENV}
if [ "${PANTS_CONFIG_FILES}" == "DEFAULT" ]; then
if [ -f "pants.ci.toml" ]; then
echo "PANTS_CONFIG_FILES=pants.ci.toml" >> ${GITHUB_ENV}
else
echo "NOT setting PANTS_CONFIG_FILES by default"
echo "because pants.ci.toml does not exist."
fi
else
echo "Setting custom PANTS_CONFIG_FILES=${PANTS_CONFIG_FILES}"
echo "PANTS_CONFIG_FILES=${PANTS_CONFIG_FILES}" >> ${GITHUB_ENV}
fi
- name: Bootstrap Pants
shell: bash
Expand Down

0 comments on commit 615843b

Please sign in to comment.