From 175d648e2053f67685b313d44970b4a24a1518d2 Mon Sep 17 00:00:00 2001 From: John SJ Anderson Date: Tue, 11 Jun 2024 09:42:15 -0700 Subject: [PATCH] Fail fast when `nextstrain-pathogen.yaml` file is missing [#92] --- .github/workflows/pathogen-repo-ci.yaml | 7 +++++++ actions/run-nextstrain-ci-build/action.yaml | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pathogen-repo-ci.yaml b/.github/workflows/pathogen-repo-ci.yaml index 71149f9..ff928c2 100644 --- a/.github/workflows/pathogen-repo-ci.yaml +++ b/.github/workflows/pathogen-repo-ci.yaml @@ -238,6 +238,13 @@ jobs: ref: ${{ needs.workflow-context.outputs.sha }} path: ${{ env.NEXTSTRAIN_GITHUB_DIR }} + - name: Verify nextstrain-pathogen.yaml file + run: > + if [[ ! -f nextstrain-pathogen.yaml ]]; then + echo "To use this workflow, there must be a 'nextstrain-pathogen.yaml' file present in the repository root"; + exit 1; + fi + - name: Set up Nextstrain runtime ${{ matrix.runtime }} uses: ./.git/nextstrain/.github/actions/setup-nextstrain-cli with: diff --git a/actions/run-nextstrain-ci-build/action.yaml b/actions/run-nextstrain-ci-build/action.yaml index d647307..ecb8c73 100644 --- a/actions/run-nextstrain-ci-build/action.yaml +++ b/actions/run-nextstrain-ci-build/action.yaml @@ -33,12 +33,12 @@ runs: env: DIR: ${{ inputs.directory }} run: | - if [[ -f nextstrain-pathogen.yaml && -f "$DIR"/Snakefile && -f "$DIR"/build-configs/ci/config.yaml ]]; then + if [[ -f "$DIR"/Snakefile && -f "$DIR"/build-configs/ci/config.yaml ]]; then nextstrain check-setup ${{ inputs.runtime }} --set-default nextstrain build "$DIR" --configfile build-configs/ci/config.yaml else echo "Skipping $DIR build due to one or more missing files." - for i in nextstrain-pathogen.yaml "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do + for i in "$DIR"/Snakefile "$DIR"/build-configs/ci/config.yaml; do [[ -f $i ]] || echo missing "$i" done fi