24 Commits
v17 ... v21

Author SHA1 Message Date
a3ccb8f597 Update pedrolamas/handlebars-action to 2.4.0 2024-02-29 07:07:00 -08:00
56b3507bfe Update DamianReeves/write-file-action to v1.3 2024-02-28 15:06:00 -08:00
70d01ca550 build(deps): bump pedrolamas/handlebars-action from 2.2.0 to 2.3.0
Bumps [pedrolamas/handlebars-action](https://github.com/pedrolamas/handlebars-action) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/pedrolamas/handlebars-action/releases)
- [Commits](https://github.com/pedrolamas/handlebars-action/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: pedrolamas/handlebars-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-28 14:55:32 -08:00
96c74d26ed build(deps): bump actions/checkout from 2 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-28 14:55:13 -08:00
0631a12d9a build(deps): bump crazy-max/ghaction-import-gpg from 5 to 6
Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 5 to 6.
- [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases)
- [Commits](https://github.com/crazy-max/ghaction-import-gpg/compare/v5...v6)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-import-gpg
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-28 14:54:51 -08:00
a72d3c5880 update peter-evans/create-pull-request to v6 2024-02-28 14:54:06 -08:00
e98d4358e3 Bump peter-evans/create-pull-request to v5 2023-10-10 13:22:51 -07:00
d374cc7d4a Mechanical migration to FlakeHub 2023-10-10 13:21:55 -07:00
af80b95b83 Update action versions to main.
Folks can pin to recent versions if they choose.
2023-09-15 21:58:32 -04:00
da2fd6f256 Update action.yml 2023-08-24 00:12:15 -04:00
fd510d25c0 Merge pull request #78 from DeterminateSystems/DS-970
DS-970: Add Magic Nix Cache and other workflow changes
2023-07-21 09:21:51 -07:00
1a057b79b1 ci: clearly name steps in update.yml 2023-07-21 15:52:27 +01:00
51e1459968 DS-970: Add Magic Nix Cache and other workflow changes
An assortment of GitHub Workflow changes, potentially including:

- Enable DeterminateSystems/magic-nix-cache-action@main
- Reference all DeterminateSystems actions via @main
- Make update.yaml consistent across repos
- Remove unnecessary github-token: from nix-installer-action
- Update actions/checkout@v2 to actions/checkout@v3
2023-07-14 10:21:02 +01:00
4fbf969957 actions/checkout@v2 -> actions/checkout@v3 2023-06-29 06:13:10 -07:00
55ddfbef62 Bump actions/checkout in example 2023-06-29 06:13:10 -07:00
dec3bc3c9b fix: removed commented commit escaping code 2023-03-29 11:11:22 -07:00
ad81b423ab fix: use multiline string 2023-03-29 11:11:22 -07:00
c7487e8c98 doc: doc a bit more specific on the options format 2023-03-29 11:11:22 -07:00
54eb0b2901 doc: Info in readme 2023-03-29 11:11:22 -07:00
8a88a06550 fix: pr message fix 2023-03-29 11:11:22 -07:00
9af2d0f36a fix : replace action using deprecated node 12 2023-03-29 11:11:22 -07:00
b55ee105d9 feat: Added nix option
fix: nix options position

Use empty list


fix options
2023-03-29 11:11:22 -07:00
bc75a5b55e expose status of PR 2023-03-27 09:17:55 -07:00
786e5cf5a2 allow to set base branch of pull request 2023-03-27 08:43:21 -07:00
8 changed files with 91 additions and 43 deletions

View File

@ -8,10 +8,12 @@ jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Enable magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Shellcheck
run: nix-shell --run 'shellcheck $(find . -type f -name "*.sh" -executable)'

View File

@ -2,15 +2,19 @@ name: update-flake-lock
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 0"
- cron: '0 0 * * 0'
jobs:
lockfile:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Enable magic Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check flake
uses: DeterminateSystems/flake-checker-action@main
- name: Update flake.lock
uses: ./.

View File

@ -8,7 +8,7 @@ jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate YAML

View File

@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
uses: DeterminateSystems/nix-installer-action@main
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@vX
uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Update flake.lock" # Title of PR to be created
pr-labels: | # Labels to be set on the PR
@ -50,7 +50,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -59,6 +59,31 @@ jobs:
inputs: input1 input2 input3
```
## Example adding options to nix command
It is also possible to use specific options to the nix command in a space separated list:
```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@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@vX
with:
nix-options: --debug --log-format raw
```
## Example that prints the number of the created PR
```yaml
@ -73,7 +98,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -102,7 +127,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -129,7 +154,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -174,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -209,7 +234,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock
@ -271,7 +296,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v1
- name: Update flake.lock

View File

@ -1,5 +1,5 @@
name: 'Update flake.lock'
description: 'Update your flake.lock and send a PR'
name: 'Update Nix Flake Lock'
description: 'Update your Nix flake.lock and send a PR'
inputs:
inputs:
description: 'A space-separated list of inputs to update. Leave empty to update all inputs.'
@ -13,6 +13,9 @@ inputs:
description: 'The message provided with the commit'
required: false
default: "flake.lock: Update"
base:
description: "Sets the pull request base branch. Defaults to the branch checked out in the workflow."
required: false
branch:
description: 'The branch of the PR to be created'
required: false
@ -92,17 +95,24 @@ inputs:
description: 'GPG Private Key Passphrase for the GPG Private Key with which to sign the commits in the PR to be created'
required: false
default: ''
nix-options:
description: 'A space-separated list of options to pass to the nix command'
required: false
default: ''
outputs:
pull-request-number:
description: 'The number of the opened pull request'
value: ${{ steps.create-pr.outputs.pull-request-number }}
pull-request-operation:
description: 'The pull request operation performed by the action, `created`, `updated` or `closed`.'
value: ${{ steps.create-pr.outputs.pull-request-operation }}
runs:
using: "composite"
steps:
- name: Import bot's GPG key for signing commits
if: ${{ inputs.sign-commits == 'true' }}
id: import-gpg
uses: crazy-max/ghaction-import-gpg@v5
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ inputs.gpg-private-key }}
fingerprint: ${{ inputs.gpg-fingerprint }}
@ -140,11 +150,12 @@ runs:
GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ env.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }}
NIX_OPTIONS: ${{ inputs.nix-options }}
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.2
uses: DamianReeves/write-file-action@v1.3
with:
path: pr_body.template
contents: ${{ inputs.pr-body }}
@ -152,20 +163,20 @@ runs:
- name: Set additional env variables (GIT_COMMIT_MESSAGE)
shell: bash
run: |
GIT_COMMIT_MESSAGE="$(git log --format=%b -n 1)"
GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//'%'/'%25'}"
GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//$'\n'/'%0A'}"
GIT_COMMIT_MESSAGE="${GIT_COMMIT_MESSAGE//$'\r'/'%0D'}"
echo "GIT_COMMIT_MESSAGE=$GIT_COMMIT_MESSAGE" >> $GITHUB_ENV
echo "GIT_COMMIT_MESSAGE is: ${GIT_COMMIT_MESSAGE}"
DELIMITER=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
COMMIT_MESSAGE="$(git log --format=%b -n 1)"
echo "GIT_COMMIT_MESSAGE<<$DELIMITER" >> $GITHUB_ENV
echo "$COMMIT_MESSAGE" >> $GITHUB_ENV
echo "$DELIMITER" >> $GITHUB_ENV
echo "GIT_COMMIT_MESSAGE is: ${COMMIT_MESSAGE}"
- name: Interpolate PR Body
uses: pedrolamas/handlebars-action@v2.2.0
uses: pedrolamas/handlebars-action@v2.4.0
with:
files: 'pr_body.template'
output-filename: 'pr_body.txt'
- name: Read pr_body.txt
id: pr_body
uses: andstor/file-reader-action@v1
uses: juliangruber/read-file-action@v1
with:
path: "pr_body.txt"
# We need to remove the pr_body files so that the
@ -176,8 +187,9 @@ runs:
run: rm -f pr_body.txt pr_body.template
- name: Create PR
id: create-pr
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
base: ${{ inputs.base }}
branch: ${{ inputs.branch }}
delete-branch: true
committer: ${{ env.GIT_COMMITTER_NAME }} ${{ env.GIT_COMMITTER_EMAIL }}
@ -187,4 +199,4 @@ runs:
assignees: ${{ inputs.pr-assignees }}
labels: ${{ inputs.pr-labels }}
reviewers: ${{ inputs.pr-reviewers }}
body: ${{ steps.pr_body.outputs.contents }}
body: ${{ steps.pr_body.outputs.content }}

18
flake.lock generated
View File

@ -2,18 +2,16 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1659131907,
"narHash": "sha256-8bz4k18M/FuVC+EVcI4aREN2PsEKT7LGmU2orfjnpCg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "8d435fca5c561da8168abb30270788d2da2a7951",
"type": "github"
"lastModified": 1696604326,
"narHash": "sha256-YXUNI0kLEcI5g8lqGMb0nh67fY9f2YoJsILafh6zlMo=",
"rev": "87828a0e03d1418e848d3dd3f3014a632e4a4f64",
"revCount": 533189,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.533189%2Brev-87828a0e03d1418e848d3dd3f3014a632e4a4f64/018b0dc8-e84f-7c59-b5d6-16849c3b2074/source.tar.gz"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.533189.tar.gz"
}
},
"root": {

View File

@ -1,7 +1,7 @@
{
description = "update-flake-lock";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.533189.tar.gz";
outputs =
{ self

View File

@ -5,12 +5,19 @@ if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
cd "$PATH_TO_FLAKE_DIR"
fi
options=()
if [[ -n "$NIX_OPTIONS" ]]; then
for option in $NIX_OPTIONS; do
options+=("${option}")
done
fi
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"
nix "${options[@]}" flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
else
nix flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
fi