From cf223c972ea811f6be0ed85ca128ae32c50acf5f Mon Sep 17 00:00:00 2001 From: Ryan De La Torre Date: Tue, 5 Mar 2024 12:35:35 -0800 Subject: [PATCH] Adding test action for cron job --- .github/workflows/cron.yml | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/cron.yml diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml new file mode 100644 index 0000000..6701f15 --- /dev/null +++ b/.github/workflows/cron.yml @@ -0,0 +1,54 @@ +name: Cron + +on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: "0 21 * * 1-5" + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + inputs: + mode: + description: "Publish mode" + required: true + default: "preview" + type: choice + options: + - preview + - publish + - force-version + version: + type: string + description: "Force version number" + dist-tag: + type: string + description: "Force version tag" + default: "latest" + +jobs: + check-inputs: + name: Check inputs + runs-on: ubuntu-latest + steps: + - if: ${{ github.event.schedule }} + run: | + test "$(npx auto version)" != "major" + - if: ${{ !github.event.schedule && github.event.inputs.mode != 'force-version' && github.event.inputs.version != '' }} + run: | + echo "::error::Please choose version mode when forcing a version number" + exit 1 + - if: ${{ !github.event.schedule && github.event.inputs.mode == 'force-version' && github.event.inputs.version == '' }} + run: | + echo "::error::Please enter a version number when forcing a specific publish version" + exit 1 + build: + name: Node v${{ matrix.node }} + if: ${{ github.event.schedule || github.event.inputs.mode == 'publish' || github.event.inputs.mode == 'force-version' || (github.event_name == 'push' && github.ref_name == 'master') }} + runs-on: ubuntu-latest + strategy: + matrix: + node: [18, 20] + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + fetch-depth: 0