Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with upstream #1

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
918b09c
Use cache.nixos.org
nmattia Jun 10, 2021
60f2360
Update niv-updater
knl Jun 28, 2021
a3733ed
Pin version of nix used for the run
knl Dec 27, 2021
a163445
Update disable directive for shellcheck
knl Dec 27, 2021
2f38eb4
When debug_output is set, make hub more verbose
knl Dec 27, 2021
50c63d8
Print the output of hub api call on error
knl Dec 27, 2021
4099db2
Fix: reformat code to make build green
knl Jan 7, 2022
89de249
Fix: use togithub.com redirects instead of duckduckgo
knl Jan 6, 2022
e2cbd43
Bump the version to v10
knl Jan 7, 2022
079a0fd
Fix retrieval of the changelog
Mar 15, 2022
dc7814a
Fix: adhere to the maximum size of PR description
Mar 16, 2022
83c62f1
fix: length of string is ${#string} not $#string
Mar 16, 2022
946b812
fix: make linter happy
Mar 16, 2022
81ce2ff
Typofix in README.adoc (#47)
ggreif Mar 16, 2022
3cad9db
feat: support node.js 16 (#54)
jfroche Dec 27, 2022
d1c3772
Bump `nix` to 2.11.1 (#53)
ggreif Dec 27, 2022
2176b71
Remove refs/heads/ from the base branch name (#57)
jfroche Jan 10, 2023
03ff454
Enable action using self hosted runners (#55)
jfroche Jan 10, 2023
353d803
Update actions/checkout
Jan 10, 2023
b038cec
Fix the text about self-hosted runners
knl Jan 10, 2023
c546ceb
Add devenv
knl Jan 10, 2023
6a3b838
Bump the version to v11
knl Jan 10, 2023
5fed162
Add dependabot to update github actions
knl Jan 10, 2023
15891c2
Bump timheuer/issue-notifier from 1.0.2 to 1.0.4
dependabot[bot] Jan 10, 2023
b1a5e32
Fix niv-updater mode
jfroche Jan 15, 2023
f21466b
Bump up the version to v12
Jan 16, 2023
acf2139
Bump actions/checkout from 3 to 4
dependabot[bot] Sep 4, 2023
1f41277
Use nodejs 20
jfroche Dec 28, 2023
cd150b7
Fix nix path in GitHub Actions
jfroche Dec 28, 2023
135c0ba
Install niv from nixpkgs 23.11
jfroche Jan 8, 2024
f563635
update devenv
Jun 19, 2023
f44f201
Bump up the version to v13
Jan 11, 2024
b7c1567
Use correct link for build status
knl Jan 11, 2024
1c5df8a
Update devenv
Oct 17, 2024
fcded23
Use new setup from cachix/install-nix action and bump nix
Oct 17, 2024
a3c069f
Add .editorconfig so shfmt has common settings
Oct 17, 2024
a52a617
Bump up nixpkgs to 24.05
Oct 17, 2024
b07dd4b
Add .pre-commit-config.yaml
Oct 17, 2024
ff7f84f
Bump up the version to v14
Oct 17, 2024
00cb5e6
Remove .pre-commit-config.yaml, it should not be tracked
Oct 17, 2024
5b63ba4
Bump up the version to v15
Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# options for shfmt(1)
binary_next_line = true
switch_case_indent = true
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
watch_file devenv.nix
watch_file devenv.yaml
watch_file devenv.lock
eval "$(devenv print-dev-env)"
9 changes: 9 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Set update schedule for GitHub Actions

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

4 changes: 2 additions & 2 deletions .github/workflows/issue-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: issue-notifier
uses: timheuer/[email protected].2
uses: timheuer/[email protected].4
env:
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install dependencies
run: |
# Get Nix
Expand All @@ -32,6 +32,7 @@ jobs:

echo "/nix/var/nix/profiles/per-user/runner/profile/bin" >> $GITHUB_PATH
echo "/nix/var/nix/profiles/default/bin" >> $GITHUB_PATH
echo "${HOME}/.nix-profile/bin" >> $GITHUB_PATH

source "${HOME}/.nix-profile/etc/profile.d/nix.sh"
# Install dependencies
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# Devenv
.devenv*
devenv.local.nix

57 changes: 46 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
= niv-updater: Automated dependency updates with niv
= niv-updater: Automated dependency updates with niv

image:https://github.com/knl/niv-updater-action/workflows/CI/badge.svg[CI]
image:https://github.com/knl/niv-updater-action/actions/workflows/main.yml/badge.svg[CI]
image:https://img.shields.io/github/v/release/knl/niv-updater-action[GitHub release (latest by date)]

This action will open a pull request to master branch (or otherwise specified
This action will open a pull request to `master` branch (or otherwise specified
branch) whenever https://github.com/nmattia/niv[niv] detects updates to
`nix/sources.json` in your repository, for each dependency separately. Each PR
will contain a beautiful Changelog of all the changes in the update, like this:

image:./assets/niv-update-action-changelog.png[title="Changelog generated by niv-updater-action]

The best way to use niv-updater-action is to set up a scheduled workflow. This
The best way to use `niv-updater-action` is to set up a scheduled workflow. This
way, whenever there are new updates, you will get a PR that you can just
approve and avoid a lot of manual work.

Expand All @@ -34,7 +34,7 @@ jobs:
steps:
# notice there is no checkout step
- name: niv-updater-action
uses: knl/niv-updater-action@v9
uses: knl/niv-updater-action@v15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
----
Expand All @@ -53,13 +53,14 @@ jobs:
This value will be passed to niv via `--sources-file` option. Defaults to
`nix/sources.json`.
* `niv_version`: (Optional) The niv version to be used. Defaults to `master`,
meaning niv-updater-action will take the latest niv for each run. You may want
to fix a particular version and avoid future breaks to your workflow.
meaning `niv-updater-action` will take the latest niv for each run. You may want
to fix a particular version and avoid future breaks to your workflow. If you're
using a self-hosted runner, set this to `*from-nixpkgs*`.
* `branch_prefix`: (Optional) The prefix used for update branches, created by
this action. The action does not sanitize the branch name. For a description
of what a valid branch name is, please consult:
https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html.
Defaults to "update/".
Defaults to `update/`.
* `keep_updating`: (Optional) If PR already exists, keep it updated with new
changes. The branch will be force updated, as this process keeps a single
commit on a branch. Defaults to `false` to maintain the old behaviour.
Expand Down Expand Up @@ -101,12 +102,12 @@ jobs:
https://github.com/knl/niv-updater-action/issues/26[Issue #26]. Defaults to
`true`.
* `debug_output`: (Optional, a boolean) If `true`, `set -x` will be turned on
for the updater script, outputing every step the action takes. This will show
for the updater script, outputting every step the action takes. This will show
up in the action log, and could be useful for trying to reproduce issues
locally. Defaults to `false`.

As the above list suggests, `niv-updater-action` is highly configurable.
The following example exposes some of the nobs, many with their default values:
The following example exposes some of the knobs, many with their default values:

[source,yaml]
----
Expand All @@ -123,7 +124,7 @@ jobs:
steps:
# notice there is no checkout step
- name: niv-updater-action
uses: knl/niv-updater-action@v9
uses: knl/niv-updater-action@v15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -165,3 +166,37 @@ Actions workflow YAML file.

* `GITHUB_TOKEN` - (Required) The GitHub API token used to create pull requests
and get content from all repositories tracked by `niv`.

== Self hosted runner

Self-hosted runners are running with dynamic users so nix profile is not
accessible, as well as nix-env. As this action relies on nix-env to install
niv, the default configuration will not work. Thus, to use niv from available
nixpkgs, set `niv_version` to `pass:[*from-nixpkgs*]`. It will install `niv`
using `nixpkgs` with nix-shell instead of nix-env.

To avoid using `sudo` (also unavailable on self-hosted runners), the input
`pass:[skip_ssh_repos]` should be set to `true`.

Example:

[source,yaml]
----
name: Automated niv-managed dependency updates
on:
schedule:
# * is a special character in YAML so you have to quote this string
# run this every day at 4:00am
- cron: '0 4 * * *'
jobs:
niv-updater:
name: 'Create PRs for niv-managed dependencies'
runs-on: self-hosted
steps:
# notice there is no checkout step
- name: niv-updater-action
uses: knl/niv-updater-action@v15
with:
niv_version: '*from-nixpkgs*'
skip_ssh_repos: true
----
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'niv Updater Action'
description: 'A GitHub action that detects updates to dependencies tracked by niv and creates pull requests to keep them up to date.'
author: 'knl'
runs:
using: 'node12'
using: 'node20'
main: 'main.js'
inputs:
pull_request_base:
Expand Down
116 changes: 116 additions & 0 deletions devenv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1729087493,
"owner": "cachix",
"repo": "devenv",
"rev": "d612b77ff73912cd82e58256ab5e84d5904abef7",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1728979988,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7881fbfd2e3ed1dfa315fca889b2cfd94be39337",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1728909085,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c0b1da36f7c34a7146501f684e9ebdf15d2bebf8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1729104314,
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3c3e88f0f544d6bb54329832616af7eb971b6be6",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}
}
},
"root": "root",
"version": 7
}
27 changes: 27 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ pkgs, ... }:

{
# https://devenv.sh/basics/
# env.GREET = "devenv";

# https://devenv.sh/packages/
packages = [ pkgs.asciidoctor ];

# enterShell = ''
# '';

# https://devenv.sh/languages/
# languages.nix.enable = true;

# https://devenv.sh/scripts/
# scripts.hello.exec = "echo hello from $GREET";

# https://devenv.sh/pre-commit-hooks/
pre-commit.hooks.shellcheck.enable = true;
pre-commit.hooks.actionlint.enable = true;
pre-commit.hooks.shfmt.enable = true;
# pre-commit.hooks.typos.enable = true;

# https://devenv.sh/processes/
# processes.ping.exec = "ping example.com";
}
4 changes: 4 additions & 0 deletions devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
# can't point to the local modules here as it's used as a template
Loading