Announcing niv-updater-action GitHub action

Hello everyone,

I’d like to announce niv-updater-action, a GitHub action to keep niv managed dependencies up. Once set up, if can ran on schedule to track updates to all dependencies that are managed by niv. If there is an update, it will create a PR, one for each outdated dependency, with a nice list of changes.

The project is hosted here: GitHub - knl/niv-updater-action: A GitHub Action that creates meaningful pull requests with updates to your niv-managed dependencies, so you don't have to do menial chores.

You can add it to your github actions as simple as:

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: ubuntu-latest
    steps:
      # notice there is no checkout step
      - name: niv-updater-action
        uses: knl/niv-updater-action@v4
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          # NOTE: All inputs are optional. This list them with their default values.
          # Use the default branch for the repository
          pull_request_base: ''
          # The prefix to add to every created branch
          branch_prefix: 'update/'
          # If there are revisions in form 'v1.2' (not SHAs), skip updating them
          skip_versioned_revisions: true
          # Do not skip dependencies in repos accessed via ssh from updating
          skip_ssh_repos: false
          # Update all dependencies tracked by niv. Another example: 'common,jq,hub'
          whitelist: ''
          # Do not blacklist any of the dependencies. Another example: 'nixpkgs,niv'
          blacklist: ''
          # Note that | is really important for the labels
          labels: |
            documentation
            good first issue
          # Let's not show merges in the changelog
          show_merges: false
          # Have some prefix and a suffix. Use '|' to keep newlines
          message_prefix: |
            ## Motivation

            Dependencies should be up to date.
          message_suffix:
            Notify @myorg/myteam.

8 Likes

Awesome!

I’d highly recommend using GitHub - cachix/install-nix-action: Installs Nix on GitHub Actions for the supported platforms: Linux and macOS. for installing Nix as it enables sandbox and thus enforces purity as Nix promises it.

Thanks. I was thinking of that and decided it’s not needed at the moment. First, I can’t use one action from another. Second, I don’t need purity, as I need just one tool, and I’m trying to fetch it without doing any builds. The reason is performance – if my action would start building something, it would take way too much time for a simple task of checking dependencies.

First, I can’t use one action from another.

Right, you need to document it.

Second, I don’t need purity, as I need just one tool, and I’m trying to fetch it without doing any builds.

Someone might have an use case to use Nix after your action though.

The reason is performance – if my action would start building something, it would take way too much time for a simple task of checking dependencies.

There’s no building, although macos installation can be much faster as it currently is.