actions-test/.forgejo/workflows/update-lock.yml
2024-11-07 21:48:13 +01:00

36 lines
1 KiB
YAML

name: Update flake.lock
on:
workflow_dispatch:
jobs:
update_flake_lock:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v14
- name: Set git config
run: |
git config --global user.name "ukubot"
git config --global user.email "bot@uku.moe"
- name: Update lockfile
id: update_lockfile
run: |
git checkout -b "update-lock-$(date -I)"
nix flake update --commit-lock-file
echo "commits=$(git log --oneline origin/main..HEAD)" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: ${{ steps.update_lockfile.outputs.commits }} != ""
run: |
git push origin HEAD
curl -X POST \
'https://git.uku3lig.net/api/v1/repos/uku/actions-test/pulls' \
-H 'Authorization: ${{ secrets.FORGEJO_TOKEN }}' \
-d '{"base": "update-lock-$(date -I)", "title": "chore: update flake.lock"}'