mirror of
https://github.com/wentasah/ros2nix.git
synced 2025-06-09 15:52:23 +03:00
45 lines
1.6 KiB
YAML
45 lines
1.6 KiB
YAML
name: Update rosdistro
|
|
on:
|
|
schedule:
|
|
- cron: "0 12 * * *"
|
|
workflow_dispatch:
|
|
jobs:
|
|
update:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: DeterminateSystems/nix-installer-action@main
|
|
- name: Configure git
|
|
run: |
|
|
git config user.name 'github-actions[bot]'
|
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
|
- name: Update rosdistro
|
|
run: |
|
|
nix build .#rosdistro --out-link /tmp/rosdistro-old
|
|
nix flake update rosdistro
|
|
nix build .#rosdistro --out-link /tmp/rosdistro-new
|
|
grep -Rh nixos: /tmp/rosdistro-old > /tmp/rosdistro-old.txt
|
|
grep -Rh nixos: /tmp/rosdistro-new > /tmp/rosdistro-new.txt
|
|
git reset --hard
|
|
if ! git diff /tmp/rosdistro-old.txt /tmp/rosdistro-new.txt > /tmp/rosdistro-diff; then
|
|
# redo update with nice commit message
|
|
nix flake update rosdistro --commit-lock-file
|
|
GIT_EDITOR='sed -i -e "1crosdistro update"' git commit --amend
|
|
GIT_EDITOR='sed -i -e "\$R/tmp/rosdistro-diff"' git commit --amend
|
|
cat <<EOF > /tmp/.body
|
|
Diff:
|
|
```diff
|
|
$(cat /tmp/rosdistro-diff)
|
|
```
|
|
EOF
|
|
else
|
|
echo "No relevant changes"
|
|
fi
|
|
git show --format='%b' --no-patch > /tmp/.body
|
|
- name: Create Pull Request
|
|
uses: peter-evans/create-pull-request@v7
|
|
with:
|
|
branch: rosdistro-updates
|
|
delete-branch: true
|
|
title: 'Rosdistro update'
|
|
body-path: /tmp/.body
|