Files
ComfyUI_frontend/.github
Christian Byrne b222cae56e [ci] Fix detached HEAD state in Playwright update workflow (#5985)
## Summary

Fixes the Playwright update workflow broken by #5960. When triggered by
adding the "New Browser Test Expectations" label, the workflow was left
in a detached HEAD state, causing `git push` to fail.

## Changes

- **Restores branch checkout for label triggers**: Uses
`github.head_ref` to fetch and checkout the branch when triggered by
`pull_request` events
- **Preserves comment trigger functionality**: Keeps `gh pr checkout`
for `issue_comment` events using `github.event.issue.number`
- **Event-specific push logic**: Uses explicit `git push origin HEAD:${{
github.head_ref }}` for label triggers, plain `git push` for comment
triggers

## Root Cause

PR #5960 removed the original branch checkout logic:
```yaml
git fetch origin ${{ github.head_ref }}
git checkout -B ${{ github.head_ref }} origin/${{ github.head_ref }}
git push origin HEAD:${{ github.head_ref }}
```

This left the label-triggered workflow in detached HEAD after
`actions/checkout@v5`, breaking the push step.

## Testing

This fix properly uses `github.head_ref` only when it's available
(`pull_request` events) and `github.event.issue.number` only for
`issue_comment` events where `head_ref` isn't available.

Fixes #5960

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-5985-ci-Fix-detached-HEAD-state-in-Playwright-update-workflow-2866d73d36508183b63bca03a40da4a8)
by [Unito](https://www.unito.io)
2025-10-08 23:58:23 -07:00
..