This commit is contained in:
pazpi 2026-01-08 12:14:10 +01:00
parent 67ffa96575
commit f3e69051f5

View file

@ -15,51 +15,18 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Configure Git
run: |
git config user.name "Flake Update Bot"
git config user.email "git@noreply.local"
- name: Update flake inputs - name: Update flake inputs
run: nix flake update run: nix flake update
- name: Check for changes
id: changes
run: |
if git diff --quiet flake.lock; then
echo "changed=false" >> $FORGEJO_OUTPUT
echo "No changes to flake.lock"
else
echo "changed=true" >> $FORGEJO_OUTPUT
echo "flake.lock has been updated"
fi
- name: Create branch and commit
id: commit
if: steps.changes.outputs.changed == 'true'
run: |
BRANCH_NAME="auto-update/$(date +%Y-%m-%d)"
git checkout -b "$BRANCH_NAME"
git add flake.lock
git commit -m "chore: update flake inputs $(date +%Y-%m-%d)"
git push origin "$BRANCH_NAME"
echo "branch_name=$BRANCH_NAME" >> $FORGEJO_OUTPUT
echo "Created and pushed branch: $BRANCH_NAME"
- name: Create Pull Request - name: Create Pull Request
if: steps.changes.outputs.changed == 'true' uses: https://github.com/maxking/forgejo-create-pr@v1
env: with:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} token: ${{ secrets.FORGEJO_TOKEN }}
run: | base: master
DATE=$(date +%Y-%m-%d) add-paths: flake.lock
commit-message: "chore: update flake inputs"
curl -X POST \ pr-title: "chore: weekly flake update"
-H "Authorization: token $FORGEJO_TOKEN" \ pr-body: "Automated flake update from CI.\n\nThis PR updates all flake inputs.\n\n**Note:** Build verification will run automatically on this PR."
-H "Content-Type: application/json" \ pr-branch: "auto-update/${{ forgejo.run_id }}"
-d '{ commit-user: "Flake Update Bot"
"title": "chore: weekly flake update ${DATE}", commit-email: "git@noreply.local"
"body": "Automated flake update from CI",
"head": "'"${{ steps.commit.outputs.branch_name }}"'",
"base": "master"
}' \
"${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/pulls"