Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
aa092a7430 | |||
913da8731c | |||
867efeb864 | |||
5e50e4bcfb | |||
0ad9a55048 | |||
0ed7fb71ea |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -12,6 +12,6 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v16
|
||||
uses: cachix/install-nix-action@v17
|
||||
- name: Shellcheck
|
||||
run: nix-shell --run 'shellcheck $(find . -type f -name "*.sh" -executable)'
|
||||
|
2
.github/workflows/update.yml
vendored
2
.github/workflows/update.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@v16
|
||||
uses: cachix/install-nix-action@v17
|
||||
with:
|
||||
extra_nix_config: |
|
||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||
|
32
README.md
32
README.md
@ -122,6 +122,38 @@ jobs:
|
||||
uses: DeterminateSystems/update-flake-lock@vX
|
||||
with:
|
||||
inputs: input1 input2 input3
|
||||
path-to-flake-dir: 'nix/' # in this example our flake doesn't sit at the root of the repository, it sits under 'nix/flake.nix'
|
||||
```
|
||||
|
||||
## Example using a different Git user
|
||||
|
||||
If you want to change the author and / or committer of the flake.lock update commit, you can tweak the `git-{author,committer}-{name,email}` options:
|
||||
|
||||
```yaml
|
||||
name: update-flake-lock
|
||||
on:
|
||||
workflow_dispatch: # allows manual triggering
|
||||
schedule:
|
||||
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
|
||||
|
||||
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: DeterminateSystems/update-flake-lock@vX
|
||||
with:
|
||||
git-author-name: 'Jane Author'
|
||||
git-author-email: 'github-actions[bot]@users.noreply.github.com'
|
||||
git-committer-name: 'John Committer'
|
||||
git-committer-email: 'github-actions[bot]@users.noreply.github.com'
|
||||
```
|
||||
|
||||
## Running GitHub Actions CI
|
||||
|
29
action.yml
29
action.yml
@ -17,6 +17,10 @@ inputs:
|
||||
description: 'The branch of the PR to be created'
|
||||
required: false
|
||||
default: "update_flake_lock_action"
|
||||
path-to-flake-dir:
|
||||
description: 'The path of the directory containing `flake.nix` file within your repository. Useful when `flake.nix` cannot reside at the root of your repository.'
|
||||
required: false
|
||||
default: ''
|
||||
pr-title:
|
||||
description: 'The title of the PR to be created'
|
||||
required: false
|
||||
@ -49,6 +53,22 @@ inputs:
|
||||
description: 'A comma or newline separated list of labels to set on the Pull Request to be created'
|
||||
required: false
|
||||
default: ''
|
||||
git-author-name:
|
||||
description: 'Author name used for commit. Only used if sign-commits is false.'
|
||||
required: false
|
||||
default: 'github-actions[bot]'
|
||||
git-author-email:
|
||||
description: 'Author email used for commit. Only used if sign-commits is false.'
|
||||
required: false
|
||||
default: 'github-actions[bot]@users.noreply.github.com'
|
||||
git-committer-name:
|
||||
description: 'Committer name used for commit. Only used if sign-commits is false.'
|
||||
required: false
|
||||
default: 'github-actions[bot]'
|
||||
git-committer-email:
|
||||
description: 'Committer email used for commit. Only used if sign-commits is false.'
|
||||
required: false
|
||||
default: 'github-actions[bot]@users.noreply.github.com'
|
||||
sign-commits:
|
||||
description: 'Set to true if the action should sign the commit with GPG'
|
||||
required: false
|
||||
@ -100,10 +120,10 @@ runs:
|
||||
if: ${{ inputs.sign-commits != 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "GIT_AUTHOR_NAME=github-actions[bot]" >> $GITHUB_ENV
|
||||
echo "GIT_AUTHOR_EMAIL=<github-actions[bot]@users.noreply.github.com>" >> $GITHUB_ENV
|
||||
echo "GIT_COMMITTER_NAME=github-actions[bot]" >> $GITHUB_ENV
|
||||
echo "GIT_COMMITTER_EMAIL=<github-actions[bot]@users.noreply.github.com>" >> $GITHUB_ENV
|
||||
echo "GIT_AUTHOR_NAME=${{ inputs.git-author-name }}" >> $GITHUB_ENV
|
||||
echo "GIT_AUTHOR_EMAIL=<${{ inputs.git-author-email }}>" >> $GITHUB_ENV
|
||||
echo "GIT_COMMITTER_NAME=${{ inputs.git-committer-name }}" >> $GITHUB_ENV
|
||||
echo "GIT_COMMITTER_EMAIL=<${{ inputs.git-committer-email }}>" >> $GITHUB_ENV
|
||||
- name: Run update-flake-lock.sh
|
||||
run: $GITHUB_ACTION_PATH/update-flake-lock.sh
|
||||
shell: bash
|
||||
@ -114,6 +134,7 @@ runs:
|
||||
GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }}
|
||||
TARGETS: ${{ inputs.inputs }}
|
||||
COMMIT_MSG: ${{ inputs.commit-msg }}
|
||||
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
|
||||
- name: Save PR Body as file
|
||||
uses: DamianReeves/write-file-action@v1.1
|
||||
with:
|
||||
|
@ -1,6 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
|
||||
cd "$PATH_TO_FLAKE_DIR"
|
||||
fi
|
||||
|
||||
if [[ -n "$TARGETS" ]]; then
|
||||
inputs=()
|
||||
for input in $TARGETS; do
|
||||
|
Reference in New Issue
Block a user