commit 413adfff734818f22f26a997c236e9b52b14ff6f Author: Luc Perkins <lucperkins@gmail.com> Date: Mon Jun 5 13:05:21 2023 +0200 Add initial README and action definition diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a56f2d2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b9db75 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# The Determinate flake checker Action + +Here's an example configuration: + +```yaml +on: + pull_request: + push: + branches: [main] + +jobs: + build: + name: Build Nix targets + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - name: Check Nix flake inputs + uses: DeterminateSystems/flake-checker-action@v1 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v3 + - name: Build default package + run: | + nix build +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..38bff9e --- /dev/null +++ b/action.yml @@ -0,0 +1,62 @@ +name: The Determinate Systems flake checker +description: TODO +branding: + icon: "box" + color: "purple" +inputs: + flake-lock-path: + description: TODO + default: flake.lock + send-statistics: + description: | + Anonymously report the number issues detected by the flake checker, which helps + measure the effectiveness of the flake checker. Set to `false` to disable. + default: true + check-outdated: + description: TODO + default: true + check-owner: + description: TODO + default: true + check-supported: + description: TODO + default: true + ignore-missing-flake-lock: + description: TODO + default: true +runs: + using: composite + steps: + - name: Install the flake checker + shell: bash + run: | + ( + set -eu + + curl --max-time 2 --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/flake-checker/stable/$RUNNER_ARCH-$RUNNER_OS > "$RUNNER_TEMP/flake-checker" + chmod +x "$RUNNER_TEMP/flake-checker" + + export NIX_FLAKE_CHECKER_FLAKE_LOCK_PATH="${{ inputs.flake-lock-path }}" + + if [ "${{ inputs.send-statistics }}" == "false" ]; then + export NIX_FLAKE_CHECKER_NO_TELEMETRY="false" + fi + + if [ "${{ inputs.check-outdated }}" == "false" ]; then + export NIX_FLAKE_CHECKER_CHECK_OUTDATED="false" + fi + + if [ "${{ inputs.check-owner }}" == "false" ]; then + export NIX_FLAKE_CHECKER_CHECK_OWNER="false" + fi + + if [ "${{ inputs.check-supported }}" == "false" ]; then + export NIX_FLAKE_CHECKER_CHECK_SUPPORTED="false" + fi + + if [ "${{ inputs.ignore-missing-flake-lock }}" == "false" ]; then + export NIX_FLAKE_CHECKER_IGNORE_MISSING_FLAKE_LOCK="false" + fi + + "$RUNNER_TEMP/flake-checker" + ) || true