Add: script for `update flake lock`
Take commands out of the `action.yml` file, and put it in a dedicated shell script.
This commit is contained in:
parent
e00d99112b
commit
a10510d383
13
action.yml
13
action.yml
|
@ -24,22 +24,15 @@ inputs:
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: $GITHUB_ACTION_PATH/update-flake-lock.sh
|
||||||
if [[ -n '${{ inputs.inputs }}' ]]; then
|
|
||||||
inputs=()
|
|
||||||
for input in ${{ inputs.inputs }}; do
|
|
||||||
inputs+=("--update-input" "$input")
|
|
||||||
done
|
|
||||||
nix flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "${{ inputs.commit-msg }}"
|
|
||||||
else
|
|
||||||
nix flake update --commit-lock-file --commit-lockfile-summary "${{ inputs.commit-msg }}"
|
|
||||||
fi
|
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
GIT_AUTHOR_NAME: github-actions[bot]
|
GIT_AUTHOR_NAME: github-actions[bot]
|
||||||
GIT_AUTHOR_EMAIL: <github-actions[bot]@users.noreply.github.com>
|
GIT_AUTHOR_EMAIL: <github-actions[bot]@users.noreply.github.com>
|
||||||
GIT_COMMITTER_NAME: github-actions[bot]
|
GIT_COMMITTER_NAME: github-actions[bot]
|
||||||
GIT_COMMITTER_EMAIL: <github-actions[bot]@users.noreply.github.com>
|
GIT_COMMITTER_EMAIL: <github-actions[bot]@users.noreply.github.com>
|
||||||
|
TARGETS: ${{ inputs.inputs }}
|
||||||
|
COMMIT_MSG: ${{ inputs.commit-msg }}
|
||||||
- run: |
|
- run: |
|
||||||
content="$(git log --format=%b -n 1)"
|
content="$(git log --format=%b -n 1)"
|
||||||
content="${content//'%'/'%25'}"
|
content="${content//'%'/'%25'}"
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ -n "$TARGETS" ]]; then
|
||||||
|
inputs=()
|
||||||
|
for input in $TARGETS; do
|
||||||
|
inputs+=("--update-input" "$input")
|
||||||
|
done
|
||||||
|
nix flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
||||||
|
else
|
||||||
|
nix flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
|
||||||
|
fi
|
Loading…
Reference in New Issue