4 Commits
v1 ... v3

Author SHA1 Message Date
64a8cc193d Remove automatic Nix installation
There is currently no (easy) way to only enable a certain composite
action step when some input is set, so just don't automatically install
Nix at all.
2021-10-26 09:22:51 -07:00
127e3e96af README: suggest release instead of branch name 2021-10-19 12:02:03 -07:00
7c39594b7e README: add daily schedule to example 2021-10-19 12:02:03 -07:00
e26f7bb412 Add commit message to PR body 2021-10-19 12:00:50 -07:00
2 changed files with 27 additions and 10 deletions

View File

@ -2,7 +2,7 @@
This is a GitHub Action that will update your flake.lock file whenever it is run.
> NOTE: We hardcode the `install_url` to a relatively recent `nixUnstable` (`nix-2.5pre20211015_130284b` currently). If you need a newer version that includes a new feature or important bug fix, feel free to file an issue or send a PR bumping the `install_url` inside the [`action.yml`](action.yml)!
> **NOTE:** As of v3, this action will no longer automatically install Nix to the action runner. You **MUST** set up a Nix with flakes support enabled prior to running this action, or your workflow will not function as expected.
## Example
@ -11,7 +11,9 @@ An example GitHub Action workflow using this action would look like the followin
```yaml
name: update-flake-lock
on:
workflow_dispatch:
workflow_dispatch: # allows manual triggering
schedule:
- cron: '0 0 * * *' # runs daily at 00:00
jobs:
lockfile:
@ -19,8 +21,15 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v14
with:
install_url: https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@main
uses: DeterminateSystems/update-flake-lock@v3
```
To have this workflow run on a recurring basis, see the [GitHub Actions documentation on the `schedule` key](https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#schedule).

View File

@ -3,11 +3,6 @@ description: 'Update your flake.lock and send a PR'
runs:
using: "composite"
steps:
- uses: cachix/install-nix-action@v14
with:
install_url: https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211015_130284b/install
extra_nix_config: |
experimental-features = nix-command flakes
- run: nix flake update --commit-lock-file
shell: bash
env:
@ -15,10 +10,23 @@ runs:
GIT_AUTHOR_EMAIL: <github-actions[bot]@users.noreply.github.com>
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: <github-actions[bot]@users.noreply.github.com>
- run: |
content="$(git log --format=%b -n 1)"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=msg::$content"
shell: bash
id: commit_message
- name: Create PR
uses: peter-evans/create-pull-request@v3
with:
branch: update_flake_lock_action
delete-branch: true
title: "flake.lock: Update"
body: Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.
body: |
Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action.
```
${{ steps.commit_message.outputs.msg }}
```