update_deps #106
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: update_deps | |
on: | |
workflow_dispatch: #allow manual triggering | |
schedule: | |
- cron: "0 4 * * *" | |
jobs: | |
update_deps: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/[email protected] | |
- name: install nix | |
uses: DeterminateSystems/nix-installer-action@v10 | |
- name: setup git | |
run: | | |
git config user.email [email protected] | |
git config user.name "GitHub Actions" | |
git checkout -b updates-${{ github.run_id }} | |
- name: update | |
run: | | |
MESSAGE="" | |
nix flake update --no-warn-dirty --commit-lock-file | |
if git rev-parse -q HEAD^; then | |
MESSAGE="$(git -P log --pretty=format:"%s%n%b" -1)" | |
git reset --soft HEAD^ | |
fi | |
if NPINS=$(nix run nixpkgs#npins -- update -f | grep -E '[^\(no changes\)]*url.*'); then | |
MESSAGE="$MESSAGE | |
npins url updates: | |
$NPINS" | |
fi | |
if [ -z "$MESSAGE" ]; then | |
exit 0 | |
fi | |
git add -A | |
git commit -m "CI update $(date -I)" -m "$MESSAGE" | |
git push -u origin updates-${{ github.run_id }} | |
PR=$(gh pr create \ | |
--base master \ | |
--body "$MESSAGE" \ | |
--fill \ | |
--title "Auto update $(date -I)") | |
gh pr merge $PR --squash --delete-branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |