Skip to content

Commit bee97ae

Browse files
committed
Fixes git workspace after checking out benchmarks
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.
1 parent b69beb1 commit bee97ae

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/ci-perf.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@ jobs:
7777
git add .phpbench latest.md
7878
git commit -m "Store benchmark results [skip ci]" || echo "No changes to commit"
7979
git push origin benchmarks
80+
81+
- name: Restore workspace
82+
if: always()
83+
run: |
84+
set -euo pipefail
85+
echo "Restoring workspace to original commit: ${GITHUB_SHA}"
86+
git fetch origin || true
87+
git checkout --detach "${GITHUB_SHA}"
88+
git reset --hard "${GITHUB_SHA}"

0 commit comments

Comments
 (0)