Skip to content

ci: do not skip detect-changes on pull requests#12145

Merged
pkuczynski merged 1 commit intomasterfrom
pkuczynski-patch-1
Mar 8, 2026
Merged

ci: do not skip detect-changes on pull requests#12145
pkuczynski merged 1 commit intomasterfrom
pkuczynski-patch-1

Conversation

@pkuczynski
Copy link
Copy Markdown
Member

No description provided.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Enable detect-changes job to run on all pull requests

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Remove conditional skip of detect-changes job on pull requests
• Allow detect-changes to run for all pull request events
• Simplify workflow condition logic by removing fork check
Diagram
flowchart LR
  A["GitHub Workflow Event"] --> B["detect-changes Job"]
  C["Previous: Skip on PR unless fork"] -.->|removed| B
  D["New: Always run on PR"] -->|enabled| B
Loading

Grey Divider

File Changes

1. .github/workflows/tests.yml ⚙️ Configuration changes +0/-1

Remove pull request skip condition from detect-changes

• Removed conditional if statement that skipped detect-changes job on pull requests
• Job now runs for all pull request events without fork repository check
• Simplifies workflow logic by removing the fork condition filter

.github/workflows/tests.yml


Grey Divider

Qodo Logo

@pkuczynski pkuczynski enabled auto-merge (squash) March 8, 2026 16:23
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 8, 2026

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. detect-changes failure masked 🐞 Bug ✓ Correctness
Description
If detect-changes fails, all jobs that needs: detect-changes will be skipped, but the final
all-passed job can still exit 0 because it does not include detect-changes in its needs list.
Now that detect-changes runs on same-repo PRs too, this can produce false-green PR checks even
when change detection is broken.
Code

.github/workflows/tests.yml[R13-16]

  detect-changes:
    runs-on: ubuntu-latest
-    if: ${{ (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.fork) }}
    outputs:
      changes: ${{ steps.detect-changes.outputs.changes }}
Evidence
all-passed aggregates only the results of jobs in its needs: array; detect-changes is not
included. Meanwhile, essentially all meaningful jobs depend on detect-changes, so a failure there
prevents the rest of the workflow from running and can be silently treated as success by
all-passed.

.github/workflows/tests.yml[13-17]
.github/workflows/tests.yml[56-59]
.github/workflows/tests.yml[152-164]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`all-passed` can report success even if `detect-changes` fails, because `detect-changes` is not part of `all-passed.needs`.

### Issue Context
Most jobs depend on `detect-changes`; when it fails, they will skip. `all-passed` only checks failures among its `needs` jobs, so it may not detect the root failure.

### Fix Focus Areas
- .github/workflows/tests.yml[152-164]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Missing explicit workflow permissions 🐞 Bug ⛨ Security
Description
With detect-changes no longer skipped on same-repo PRs, this workflow will now run for internal
pull requests too, but it does not set any explicit permissions:. That makes the workflow’s token
capabilities depend on repo/org defaults and increases the blast radius if defaults are broader than
needed.
Code

.github/workflows/tests.yml[R13-16]

  detect-changes:
    runs-on: ubuntu-latest
-    if: ${{ (github.event_name != 'pull_request') || (github.event.pull_request.head.repo.fork) }}
    outputs:
      changes: ${{ steps.detect-changes.outputs.changes }}
Evidence
tests.yml runs on pull_request and has no explicit permissions: block, while other workflows
in this repo do explicitly scope permissions (suggesting least-privilege is an established practice
here). As this workflow executes third-party actions and project scripts on PRs, explicitly scoping
GITHUB_TOKEN permissions reduces accidental privilege exposure and makes behavior consistent
across settings.

.github/workflows/tests.yml[1-7]
.github/workflows/tests.yml[13-22]
.github/workflows/pull-request.yml[14-20]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The workflow runs on `pull_request` but does not explicitly scope `GITHUB_TOKEN` permissions.

### Issue Context
Other workflows in the repo explicitly set `permissions:`, indicating a least-privilege approach. With this workflow now running on same-repo PRs as well, relying on repo/org defaults is riskier and less predictable.

### Fix Focus Areas
- .github/workflows/tests.yml[1-25]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 80.291%. remained the same
when pulling e0e3e39 on pkuczynski-patch-1
into b3a27e5 on master.

@G0maa G0maa self-requested a review March 8, 2026 17:23
@alumni
Copy link
Copy Markdown
Collaborator

alumni commented Mar 8, 2026

I think we could to fix a few more things while we are at it:

  • nightly publish pipeline runs on forks
  • docs publishing runs on forks

Not sure about coverage, for me it works and I am using it, I don't remember if I set it up or it just worked, I've had it for many years.

@pkuczynski pkuczynski merged commit 056ee2d into master Mar 8, 2026
60 checks passed
@pkuczynski pkuczynski deleted the pkuczynski-patch-1 branch March 8, 2026 17:46
@github-actions github-actions bot added this to the 1.0 milestone Mar 8, 2026
@alumni
Copy link
Copy Markdown
Collaborator

alumni commented Mar 8, 2026

@pkuczynski @G0maa I think this was our only check that was preventing running the workflows twice in this repo (if the contributor is pushing to this repo, not to their fork).

We could also just block push access for contributors 🤷🏻

Later edit: I see that now the tests are no longer running in forks (unless it's the master branch) - maybe the condition should've been slightly adjusted instead of removed. We want to run the actions in forks in any branch (so PR authors can test their changes without spamming us or running too many actions in our repo) + we want to run in PRs and in our master/version branches.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants