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.
This commit is contained in:
Cole Helbling 2021-12-03 10:24:07 -08:00
parent 30320f06f5
commit 2dc5d432c4
4 changed files with 10 additions and 49 deletions

View file

@ -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)'

View file

@ -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: ./.

View file

@ -8,7 +8,16 @@ inputs:
runs: runs:
using: "composite" using: "composite"
steps: 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 shell: bash
env: env:
GIT_AUTHOR_NAME: github-actions[bot] GIT_AUTHOR_NAME: github-actions[bot]

View file

@ -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