Skip to content

Commit 51df6ea

Browse files
selfuryonaldoborrero
authored andcommitted
chore(ci): try to migrate to auto-sign all commits by bot
1 parent e5bb8e8 commit 51df6ea

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

.github/workflows/update-flake.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ jobs:
7272
uses: cachix/install-nix-action@v31
7373
with:
7474
github_access_token: ${{ steps.app-token.outputs.token }}
75-
- name: Set up git
76-
run: |
77-
git config user.name "github-actions[bot]"
78-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
7975
- name: Perform update
8076
id: update
8177
env:
@@ -88,19 +84,46 @@ jobs:
8884
else
8985
.github/actions/update.sh "${{ matrix.type }}" "${{ matrix.name }}"
9086
fi
87+
- name: Prepare PR metadata
88+
id: pr-metadata
89+
if: steps.update.outputs.updated == 'true'
90+
run: |
91+
if [ "${{ matrix.type }}" = "package" ]; then
92+
echo "branch=update/${{ matrix.name }}" >> "$GITHUB_OUTPUT"
93+
echo "title=${{ matrix.name }}: ${{ matrix.current_version }} -> ${{ steps.update.outputs.new_version }}" >> "$GITHUB_OUTPUT"
94+
echo "body=Automated update of ${{ matrix.name }} from ${{ matrix.current_version }} to ${{ steps.update.outputs.new_version }}." >> "$GITHUB_OUTPUT"
95+
else
96+
echo "branch=update-${{ matrix.name }}" >> "$GITHUB_OUTPUT"
97+
echo "title=flake.lock: Update ${{ matrix.name }}" >> "$GITHUB_OUTPUT"
98+
cat <<EOF >> "$GITHUB_OUTPUT"
99+
body<<EOFMARKER
100+
This PR updates the flake input \`${{ matrix.name }}\` to the latest version.
101+
102+
## Changes
103+
- ${{ matrix.name }}: \`${{ matrix.current_version }}\` → \`${{ steps.update.outputs.new_version }}\`
104+
EOFMARKER
105+
EOF
106+
fi
91107
- name: Create pull request
92108
if: steps.update.outputs.updated == 'true'
109+
uses: peter-evans/create-pull-request@v7
110+
id: create-pr
111+
with:
112+
token: ${{ steps.app-token.outputs.token }}
113+
commit-message: ${{ steps.pr-metadata.outputs.title }}
114+
branch: ${{ steps.pr-metadata.outputs.branch }}
115+
delete-branch: true
116+
title: ${{ steps.pr-metadata.outputs.title }}
117+
body: ${{ steps.pr-metadata.outputs.body }}
118+
labels: ${{ inputs.pr-labels }}
119+
signoff: true
120+
sign-commits: true
121+
- name: Enable auto-merge
122+
if: steps.update.outputs.updated == 'true' && inputs.auto-merge == true && steps.create-pr.outputs.pull-request-number != ''
93123
env:
94124
GH_TOKEN: ${{ steps.app-token.outputs.token }}
95-
PR_LABELS: ${{ inputs.pr-labels }}
96-
AUTO_MERGE: ${{ inputs.auto-merge }}
97125
run: |
98-
# The script should be available from the checkout
99-
.github/actions/create-pr.sh \
100-
"${{ matrix.type }}" \
101-
"${{ matrix.name }}" \
102-
"${{ matrix.current_version }}" \
103-
"${{ steps.update.outputs.new_version }}"
126+
gh pr merge ${{ steps.create-pr.outputs.pull-request-number }} --auto --squash || echo "Note: Auto-merge may require branch protection rules"
104127
summary:
105128
needs: [discover, update]
106129
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)