Skip to content

Fixes git workspace after checking out benchmarks#1636

Merged
alganet merged 1 commit intoRespect:mainfrom
alganet:hotfix-action-perf
Jan 29, 2026
Merged

Fixes git workspace after checking out benchmarks#1636
alganet merged 1 commit intoRespect:mainfrom
alganet:hotfix-action-perf

Conversation

@alganet
Copy link
Member

@alganet alganet commented Jan 28, 2026

With the introduction of composite actions in the GitHub workflows, the ci-perf.yml workflow broke.

This happens because the setup-action configures a Post Run (a hook to be executed after the workflow).

Since the benchmarks checkout a different orphan branch, when that Post Run executes, it cannot find the action anymore.

To fix it, I introduce a new step that restores the git workspace, making it available for that hook.


Example failure:

https://github.com/Respect/Validation/actions/runs/21448771339/job/61772437584

image

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.03%. Comparing base (b69beb1) to head (b5e3258).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #1636   +/-   ##
=========================================
  Coverage     98.03%   98.03%           
  Complexity      961      961           
=========================================
  Files           197      197           
  Lines          2234     2234           
=========================================
  Hits           2190     2190           
  Misses           44       44           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alganet alganet requested a review from Copilot January 28, 2026 18:22
@alganet alganet marked this pull request as ready for review January 28, 2026 18:22
@alganet alganet requested a review from henriquemoody January 28, 2026 18:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes ci-perf.yml failures caused by checking out the benchmarks orphan branch, which breaks subsequent post-run hooks for local/composite actions by restoring the workspace back to the original commit.

Changes:

  • Adds an always-run step to restore the git workspace to ${GITHUB_SHA} after pushing benchmark results.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

With the introduction of composite actions in the GitHub workflows,
the ci-perf.yml workflow broke.

This happens because the setup-action configures a Post Run (a hook
to be executed after the workflow).

Since the benchmarks checkout a different orphan branch, when that
Post Run executes, it cannot find the action anymore.

To fix it, I introduce a new step that restores the git workspace,
making it available for that hook.
@alganet alganet force-pushed the hotfix-action-perf branch from 36c2a09 to b5e3258 Compare January 28, 2026 18:26
Copy link
Member

@henriquemoody henriquemoody left a comment

Choose a reason for hiding this comment

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

I'm not absolutely sure, but isn't this what actions/checkout@v6 does? Perhaps we could use it also at the start of the job to checkout the benchmarks branch?

@alganet
Copy link
Member Author

alganet commented Jan 28, 2026

@henriquemoody

If we checkout only the benchmarks branch, there will be no vendor/bin/phpbench or benchmark classes to run.

I need to first checkout the codebase, run the benchmarks, then checkout the benchmarks and update it with the results.

Perhaps there are better ways of doing it, but I could not find them.

I know for sure this restore works because I did it in the PHL repository (it has a similar coverage branch also with composite actions): https://github.com/alganet/PHL/blob/main/.github/workflows/build.yml#L170

Perhaps we can do another checkout at the end, but I never tried that.

@henriquemoody
Copy link
Member

I suggested using actions/checkout@v6 so you didn't have to run those Git commands in so many places, and just using actions/checkout@v6 to handle that. You can use it into different paths with different branches, but it's not an issue, using the git commands is just fine.

@alganet alganet merged commit bee97ae into Respect:main Jan 29, 2026
7 of 8 checks passed
@alganet alganet deleted the hotfix-action-perf branch January 29, 2026 11:06
@alganet
Copy link
Member Author

alganet commented Jan 29, 2026

I can confirm the fix worked as intended:

image

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.

3 participants