[tools.nix] fix formatting #6681
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: niv-update | |
on: | |
push: | |
schedule: | |
- cron: '0 0 * * 1' | |
jobs: | |
niv-update: | |
runs-on: ubuntu-latest | |
env: | |
# Results in crate2nix being updated every hour! | |
# - crate2nix | |
sources: nixpkgs nix-test-runner cargo-release nixpkgs-mozilla cachix | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v20 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: eigenvalue | |
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | |
- name: Install niv | |
run: nix-env -if ./nix/dependencies.nix -A dev.niv | |
- name: Update each source and push changes | |
run: | | |
failed="" | |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
for source in $sources; do | |
git fetch origin master | |
git reset --hard origin/master | |
niv update $source | |
if test -n "$(git status --porcelain)"; then | |
( | |
set -x | |
git --no-pager diff HEAD | |
git config --local user.email '[email protected]' | |
git config --local user.name 'Peter Kolloch, Bot' | |
n=0 | |
until [ $n -ge 5 ] | |
do | |
git commit -m "niv update: updated $source" -a | |
./run_tests.sh --no-cargo-build || { | |
echo "Tests failed. Skip updating $source." | |
failed="$failed $source" | |
break | |
} | |
git push && break | |
n=$[$n+1] | |
sleep 1 | |
# Another try | |
git fetch | |
git reset --hard origin/master | |
niv update $source | |
done | |
if [ $n -ge 5 ]; then | |
echo "gave up after 5 tries" | |
exit 1 | |
fi | |
) | |
else | |
echo "no change for $source" | |
fi | |
done | |
if [ -n "$failed" ]; then | |
echo "The following sources couldn't be updated " | |
echo "because of test failures:" | |
echo "$failed" | |
exit 3 | |
fi |