From 2dc5d432c413ae4fef64944d0ce3032588260c34 Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Fri, 3 Dec 2021 10:24:07 -0800 Subject: [PATCH 1/2] Don't use an external script for multiple inputs All consumers would then have to bring this script into their repo, since GitHub doesn't have something like Nix's string context. --- .github/workflows/ci.yml | 17 ----------------- .github/workflows/update.yml | 19 ------------------- action.yml | 11 ++++++++++- update-input-or-inputs.sh | 12 ------------ 4 files changed, 10 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/update.yml delete mode 100755 update-input-or-inputs.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 6ee1d0a..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: CI -on: - pull_request: - push: - branches: [main] - -jobs: - shellcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Install Nix - uses: cachix/install-nix-action@v16 - - name: Shellcheck - run: nix-shell --run 'shellcheck $(find . -type f -name "*.sh" -executable)' diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index 93ec9cc..0000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: update-flake-lock -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * 0' - -jobs: - lockfile: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Install Nix - uses: cachix/install-nix-action@v16 - with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Update flake.lock - uses: ./. diff --git a/action.yml b/action.yml index e9fecd3..78e3349 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,16 @@ inputs: runs: using: "composite" steps: - - run: ./update-input-or-inputs.sh ${{ inputs.inputs }} + - run: | + if [[ -n '${{ inputs.inputs }}' ]]; then + inputs=() + for input in ${{ inputs.inputs }}; do + inputs+=("--update-input" "$input") + done + nix flake lock "${inputs[@]}" --commit-lock-file + else + nix flake update --commit-lock-file + fi shell: bash env: GIT_AUTHOR_NAME: github-actions[bot] diff --git a/update-input-or-inputs.sh b/update-input-or-inputs.sh deleted file mode 100755 index d01d0e3..0000000 --- a/update-input-or-inputs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -to_update=$* - -if [ -n "$to_update" ]; then - inputs=() - for input in $to_update; do - inputs+=("--update-input" "$input") - done - nix flake lock "${inputs[@]}" --commit-lock-file -else - nix flake update --commit-lock-file -fi From 11002c9dd5ccbfe95575e3c91e674b35cb6fff3e Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Fri, 3 Dec 2021 10:24:22 -0800 Subject: [PATCH 2/2] ci: validate YAML --- .github/workflows/validate.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..e0f018f --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,20 @@ +name: CI +on: + pull_request: + push: + branches: [main] + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Validate YAML + uses: nwisbeta/validate-yaml-schema@v1.0.3 + with: + yamlSchemasJson: | + { + "https://json.schemastore.org/github-action.json": ["action.yml"] + }