Skip to content

Commit 62fcbcc

Browse files
committed
fix(ci): pass flake.lock via outputs, only push after successful build
1 parent d8af5dc commit 62fcbcc

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/emacs-overlay.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
if: github.repository_owner == 'djgoku'
1717
outputs:
1818
changes_exist: ${{ steps.update.outputs.changes_exist }}
19+
flake_lock: ${{ steps.update.outputs.flake_lock }}
1920
steps:
2021
- uses: actions/checkout@v6
2122
with:
@@ -32,17 +33,16 @@ jobs:
3233
id: update
3334
working-directory: emacs-overlay
3435
run: |
35-
echo "=== Running mise update task ==="
36-
OUTPUT=$(mise run update 2>&1) || true
37-
echo "=== Task output ==="
38-
echo "$OUTPUT"
39-
echo "=== Checking for changes ==="
40-
if echo "$OUTPUT" | grep -q "CHANGES_EXIST=true"; then
41-
echo "Changes detected, build will be triggered"
42-
echo "changes_exist=true" >> $GITHUB_OUTPUT
43-
else
36+
mise run update
37+
if git diff --quiet flake.lock; then
4438
echo "No changes detected, build will be skipped"
4539
echo "changes_exist=false" >> $GITHUB_OUTPUT
40+
else
41+
echo "Changes detected, build will be triggered"
42+
echo "changes_exist=true" >> $GITHUB_OUTPUT
43+
echo "flake_lock<<EOF" >> $GITHUB_OUTPUT
44+
cat flake.lock >> $GITHUB_OUTPUT
45+
echo "EOF" >> $GITHUB_OUTPUT
4646
fi
4747
build:
4848
if: needs.update.outputs.changes_exist == 'true'
@@ -63,6 +63,9 @@ jobs:
6363
install: false
6464
- name: Install mise nix plugin
6565
run: mise plugins install nix https://github.com/jbadeau/mise-nix.git
66+
- name: Write updated flake.lock
67+
working-directory: emacs-overlay
68+
run: echo '${{ needs.update.outputs.flake_lock }}' > flake.lock
6669
- name: Build Emacs
6770
working-directory: emacs-overlay
6871
run: mise run build
@@ -74,5 +77,14 @@ jobs:
7477
- uses: actions/checkout@v6
7578
with:
7679
ref: ${{ inputs.build-branch || 'build-emacs-overlay' }}
77-
- name: Push updated flake.lock
78-
run: git push
80+
- name: Write updated flake.lock
81+
working-directory: emacs-overlay
82+
run: echo '${{ needs.update.outputs.flake_lock }}' > flake.lock
83+
- name: Commit and push
84+
working-directory: emacs-overlay
85+
run: |
86+
git config user.name "github-actions[bot]"
87+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
88+
git add flake.lock
89+
git commit -m "Updated flake inputs for latest emacs-overlay"
90+
git push

0 commit comments

Comments
 (0)