From 9a12f54aa87e95724ba82c5a9716c8fbe03dbeb6 Mon Sep 17 00:00:00 2001 From: pazpi Date: Thu, 8 Jan 2026 13:30:30 +0100 Subject: [PATCH] Revert because not working --- .forgejo/workflows/auto-update-pr.yaml | 55 ++++++++++++++++++++------ 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/.forgejo/workflows/auto-update-pr.yaml b/.forgejo/workflows/auto-update-pr.yaml index 68bcc41..290b4e4 100644 --- a/.forgejo/workflows/auto-update-pr.yaml +++ b/.forgejo/workflows/auto-update-pr.yaml @@ -15,18 +15,51 @@ jobs: with: 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 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 - uses: https://github.com/maxking/forgejo-create-pr@main - with: - token: ${{ secrets.FORGEJO_TOKEN }} - base: master - add-paths: flake.lock - commit-message: "chore: update flake inputs" - pr-title: "chore: weekly flake update" - 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." - pr-branch: "auto-update/${{ forgejo.run_id }}" - commit-user: "Flake Update Bot" - commit-email: "git@noreply.local" + if: steps.changes.outputs.changed == 'true' + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} + run: | + DATE=$(date +%Y-%m-%d) + + curl -X POST \ + -H "Authorization: token $FORGEJO_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "title": "chore: weekly flake update", + "body": "Automated flake update from CI", + "head": "'"${{ steps.commit.outputs.branch_name }}"'", + "base": "master" + }' \ + "${{ forgejo.api_url }}/repos/${{ forgejo.repository }}/pulls"