Skip to content

Commit 985c304

Browse files
authored
Merge pull request #66 from SenaxInc/copilot/fix-yaml-error-during-push
Fix detached HEAD error and optimize html-render workflow
2 parents 3c48bb1 + 7a0c586 commit 985c304

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/html-render.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
steps:
2424
- name: Checkout repository
2525
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.head_ref || github.ref_name }}
28+
fetch-depth: 1
2629

2730
- name: Setup Node.js
2831
uses: actions/setup-node@v4
@@ -284,12 +287,13 @@ jobs:
284287
EOF
285288
286289
- name: Commit and push changes
290+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
287291
run: |
288292
git config --local user.email "github-actions[bot]@users.noreply.github.com"
289293
git config --local user.name "github-actions[bot]"
290294
git add TankAlarm-092025-Server-Hologram/WEBSITE_PREVIEW.md TankAlarm-092025-Server-Hologram/screenshots/
291295
git add TankAlarm-112025-Server-BluesOpta/WEBSITE_PREVIEW.md TankAlarm-112025-Server-BluesOpta/screenshots/
292296
git diff --staged --quiet || git commit -m "Update website preview screenshots [skip ci]"
293-
git push
297+
git push origin HEAD:${{ github.head_ref || github.ref_name }}
294298
env:
295299
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)