mirror of
https://github.com/wentasah/ros2nix.git
synced 2025-06-11 00:24:48 +03:00
Move rosdistro updating to a separate script
... and fix bugs
This commit is contained in:
parent
ee76acc9c9
commit
527b8460e5
2 changed files with 28 additions and 23 deletions
25
.github/workflows/update.yml
vendored
25
.github/workflows/update.yml
vendored
|
@ -13,29 +13,8 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git config user.name 'github-actions[bot]'
|
git config user.name 'github-actions[bot]'
|
||||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
- name: Update rosdistro
|
- name: Update rosdistro /tmp/.body
|
||||||
run: |
|
run: ./maint/rosdistro-update.sh
|
||||||
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
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
|
|
26
maint/rosdistro-update.sh
Executable file
26
maint/rosdistro-update.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
pr_body=${1:-/tmp/.body}
|
||||||
|
|
||||||
|
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 -U0 /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 > "$pr_body"
|
||||||
|
Diff:
|
||||||
|
\`\`\`diff
|
||||||
|
$(cat /tmp/rosdistro-diff)
|
||||||
|
\`\`\`
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
echo "No relevant changes"
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue