Compare commits

..

No commits in common. "update" and "main" have entirely different histories.
update ... main

View file

@ -13,9 +13,6 @@ inputs:
title:
default: '[bot]: flake bump'
required: false
post-workflow:
default: ''
required: false
runs:
using: "composite"
@ -32,7 +29,7 @@ runs:
run: |
BRANCH="flake-update-$(date +%s)"
echo "Creating branch $BRANCH"
# git fetch --all
git fetch --all
git checkout -b "$BRANCH"
echo branch=$BRANCH >> $GITHUB_OUTPUT
- name: "Check for updates"
@ -40,9 +37,8 @@ runs:
shell: bash
run: |
echo "Checking for flake updates"
cp flake.lock test.lock
nix flake update --output-lock-file test.lock
if ! (diff -q flake.lock test.lock); then
nix flake update
if git status --porcelain; then
echo change=true >> $GITHUB_OUTPUT
else
echo change=false >> $GITHUB_OUTPUT
@ -52,27 +48,26 @@ runs:
id: push
if: steps.changes.outputs.change == 'true'
run: |
echo "Creating PR for branch ${{ steps.clone.outputs.branch }}"
mv test.lock flake.lock
echo "Creating PR"
git add flake.lock
git commit -m "${{ inputs.title }}"
git push --force-with-lease origin "${{ steps.clone.outputs.branch }}"
git push --force-with-lease origin "${{ steps.clone.outputs.clone.branch }}"
RESPONSE=$(curl -X 'POST' \
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/pulls" \
-H 'accept: application/json' \
-H "Authorization: token $GITHUB_TOKEN" \
-H 'Content-type: application/json' \
-d '{
-d "{
"base": "${{ inputs.base }}",
"head": "${{ steps.clone.outputs.branch }}",
"head": "${{ steps.clone.outputs.clone.branch }}",
"title": "automated flake update"
}')
}")
NUMBER=$(echo $RESPONSE | jq -r '.number')
echo "Created PR $NUMBER."
echo NUMBER=$NUMBER >> $GITHUB_OUTPUT
- name: "Set automerge on PR and run workflow"
- name: "Set automerge on PR"
shell: bash
if: steps.changes.outputs.change == 'true' && steps.push.outputs.number != 'null'
run: |
@ -87,17 +82,3 @@ runs:
"delete_branch_after_merge": true
}')
echo $RESPONSE
- name: "Execute workflow on PR"
shell: bash
if: inputs.post-workflow != ''
run: |
curl -X 'POST' \
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/actions/workflows/${{ inputs.post-workflow }}/dispatches" \
-H 'accept: application/json' \
-H "Authorization: token $GITHUB_TOKEN" \
-H 'Content-Type: application/json' \
-d "{
\"ref\": \"$(git rev-parse --verify HEAD)\"
}"