Add script and Github workflow to automate colcon updates

This commit is contained in:
Michal Sojka 2024-09-04 23:56:56 +02:00 committed by Ben Wolsieffer
parent 44ad5c0a4a
commit dde852afc9
2 changed files with 48 additions and 0 deletions

31
.github/workflows/update-colcon.yaml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Update colcon packages
on:
schedule:
- cron: "0 12 * * FRI"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v27
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: ros
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Update colcon
run: maintainers/scripts/update-colcon.sh --build --commit
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
branch: colcon-updates
delete-branch: true
title: 'Colcon updates'
body: |
Automated changes by `maintainers/scripts/update-colcon.sh`

View file

@ -0,0 +1,17 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash --pure
#! nix-shell -p jq nix nix-update cacert git
# Usage: update-colcon.sh [nix-update options]
set -euo pipefail
nix eval --json --impure --expr '
let
pkgs = (import ./. {});
lib = pkgs.lib;
colconPkgs = lib.filterAttrs (n: v: builtins.substring 0 7 n == "colcon-") pkgs.python3Packages;
in
lib.attrNames colconPkgs' \
| jq --raw-output '.[]' \
| while read pkg; do nix-update "$@" python3Packages."$pkg"; done