Skip to content

Fix prettier workflow for fork PRs#90

Open
rudivice wants to merge 2 commits intoinvoiceradar:mainfrom
rudivice:fix-prettier-workflow-for-forks
Open

Fix prettier workflow for fork PRs#90
rudivice wants to merge 2 commits intoinvoiceradar:mainfrom
rudivice:fix-prettier-workflow-for-forks

Conversation

@rudivice
Copy link
Copy Markdown
Contributor

@rudivice rudivice commented Mar 5, 2026

Problem

The prettier workflow uses ref: ${{ github.head_ref }} which tries to checkout the PR branch from the base repository. For PRs from forks, this fails because the branch only exists in the contributor's fork.

Solution

  • On PRs: Checkout from the fork's repo/SHA and run prettier --check (read-only, no commit needed)
  • On push to main: Keep the existing auto-commit behavior via creyD/prettier_action

This way fork PRs can be validated without needing write access to the fork.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9baca1040e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use branch ref for push checkout

On push events this ref expression resolves to github.sha, which checks out a detached HEAD; the following creyD/prettier_action step is expected to create and push a formatting commit back to main, and detached checkouts commonly fail branch-based pushes when changes are present. This means auto-formatting on push can break even though the workflow intends to keep that behavior for main.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant