Skip to content

Commit

Permalink
Add script and Github workflow to automate colcon updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wentasah authored and lopsided98 committed Sep 19, 2024
1 parent 44ad5c0 commit dde852a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/update-colcon.yaml
Original file line number Diff line number Diff line change
@@ -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`
17 changes: 17 additions & 0 deletions maintainers/scripts/update-colcon.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit dde852a

Please sign in to comment.