Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/fix-php-code-styling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
Copy link

Choose a reason for hiding this comment

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

Bug: actions/checkout uses github.head_ref on push events, leading to checkout of the default branch instead of dev.
Severity: CRITICAL | Confidence: High

🔍 Detailed Analysis

The workflow is configured to trigger on push events to the dev branch but uses ref: ${{ github.head_ref }} in the actions/checkout step. For push events, github.head_ref is an empty string. This causes actions/checkout to silently fall back to checking out the repository's default branch (e.g., main or master) instead of the intended dev branch. Consequently, code styling fixes are applied and committed to the default branch, rather than the dev branch, which defeats the workflow's purpose and could lead to unintended changes on production or release branches.

💡 Suggested Fix

Modify the actions/checkout step to use ref: ${{ github.ref }} or ref: ${{ github.sha }} for push events to ensure the correct branch that triggered the workflow is checked out.

🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/fix-php-code-styling.yml#L18

Potential issue: The workflow is configured to trigger on `push` events to the `dev`
branch but uses `ref: ${{ github.head_ref }}` in the `actions/checkout` step. For `push`
events, `github.head_ref` is an empty string. This causes `actions/checkout` to silently
fall back to checking out the repository's default branch (e.g., `main` or `master`)
instead of the intended `dev` branch. Consequently, code styling fixes are applied and
committed to the default branch, rather than the `dev` branch, which defeats the
workflow's purpose and could lead to unintended changes on production or release
branches.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3271537

with:
ref: ${{ github.head_ref }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v6

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
ref: main

Expand Down