fix: only skip fetching when a commit exists locally #1293

Merged
mfenniak merged 1 commit from aahlenst/runner:fix-skipped-fetch into main 2026-01-15 02:21:27 +00:00
Member

When attempting to update a clone of an action or a reusable workflow with a commit reference, Forgejo Runner would erroneously not fetch the remote because it believed that commit were already present. That leads to an error:

runner(version:v12.5.2) received task 2 of job test, be triggered by event: push
workflow prepared
evaluating expression 'success()'
expression 'success()' evaluated to 'true'
  git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 remote get-url origin
  git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 rev-parse c58510e7c779846cb5f0801a159cbf91d971026c
Found revision: c58510e7c779846cb5f0801a159cbf91d971026c
  ☁️  git fetch 'http://192.168.124.88:3000/root/example-private-workflow-call' skipped; ref=c58510e7c779846cb5f0801a159cbf91d971026c cached
  git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 rev-parse c58510e7c779846cb5f0801a159cbf91d971026c
Found revision: c58510e7c779846cb5f0801a159cbf91d971026c
  git worktree create for ref=c58510e7c779846cb5f0801a159cbf91d971026c (sha=c58510e7c779846cb5f0801a159cbf91d971026c) to /tmp/tmp.K9MTg4Hvs0/.cache/act/66/f8d01b29c88af989524f5b0324dcf963a4c0c9f8e118bc2795cd711a1a853d
  git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 worktree add -f --end-of-options /tmp/tmp.K9MTg4Hvs0/.cache/act/66/f8d01b29c88af989524f5b0324dcf963a4c0c9f8e118bc2795cd711a1a853d c58510e7c779846cb5f0801a159cbf91d971026c
git worktree add error: fatal: invalid reference: c58510e7c779846cb5f0801a159cbf91d971026c: exit status 128

The reason is that git rev-parse skips the existence check if a full commit hash is supplied.

  • bug fixes
    • PR: fix: only skip fetching when a commit exists locally
When attempting to update a clone of an action or a reusable workflow with a commit reference, Forgejo Runner would erroneously not fetch the remote because it believed that commit were already present. That leads to an error: ``` runner(version:v12.5.2) received task 2 of job test, be triggered by event: push workflow prepared evaluating expression 'success()' expression 'success()' evaluated to 'true' git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 remote get-url origin git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 rev-parse c58510e7c779846cb5f0801a159cbf91d971026c Found revision: c58510e7c779846cb5f0801a159cbf91d971026c ☁️ git fetch 'http://192.168.124.88:3000/root/example-private-workflow-call' skipped; ref=c58510e7c779846cb5f0801a159cbf91d971026c cached git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 rev-parse c58510e7c779846cb5f0801a159cbf91d971026c Found revision: c58510e7c779846cb5f0801a159cbf91d971026c git worktree create for ref=c58510e7c779846cb5f0801a159cbf91d971026c (sha=c58510e7c779846cb5f0801a159cbf91d971026c) to /tmp/tmp.K9MTg4Hvs0/.cache/act/66/f8d01b29c88af989524f5b0324dcf963a4c0c9f8e118bc2795cd711a1a853d git -C /tmp/tmp.K9MTg4Hvs0/.cache/act/4f/03a001f96fcf7afd5f55aed90c7de6ae304b7f800980f5e3f6d414a38e7ae7 worktree add -f --end-of-options /tmp/tmp.K9MTg4Hvs0/.cache/act/66/f8d01b29c88af989524f5b0324dcf963a4c0c9f8e118bc2795cd711a1a853d c58510e7c779846cb5f0801a159cbf91d971026c git worktree add error: fatal: invalid reference: c58510e7c779846cb5f0801a159cbf91d971026c: exit status 128 ``` The reason is that `git rev-parse` skips the existence check if a full commit hash is supplied. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1293): <!--number 1293 --><!--line 0 --><!--description Zml4OiBvbmx5IHNraXAgZmV0Y2hpbmcgd2hlbiBhIGNvbW1pdCBleGlzdHMgbG9jYWxseQ==-->fix: only skip fetching when a commit exists locally<!--description--> <!--end release-notes-assistant-->
aahlenst force-pushed fix-skipped-fetch from cdff89a238
Some checks failed
checks / validate mocks (pull_request) Successful in 1m1s
checks / validate pre-commit-hooks file (pull_request) Successful in 1m8s
checks / Build Forgejo Runner (pull_request) Successful in 1m29s
checks / runner exec tests (pull_request) Successful in 55s
issue-labels / release-notes (pull_request_target) Successful in 6s
Integration tests for the release process / release-simulation (pull_request) Successful in 6m4s
checks / integration tests (docker-stable) (pull_request) Has been cancelled
checks / integration tests (docker-latest) (pull_request) Has been cancelled
to a99f76f608
All checks were successful
checks / Build Forgejo Runner (pull_request) Successful in 39s
checks / validate mocks (pull_request) Successful in 47s
checks / validate pre-commit-hooks file (pull_request) Successful in 49s
checks / runner exec tests (pull_request) Successful in 50s
Integration tests for the release process / release-simulation (pull_request) Successful in 5m41s
checks / integration tests (docker-latest) (pull_request) Successful in 11m14s
checks / integration tests (docker-stable) (pull_request) Successful in 13m26s
issue-labels / release-notes (pull_request_target) Successful in 5s
cascade / forgejo (pull_request_target) Successful in 19s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 5s
2026-01-14 16:44:21 +00:00
Compare
mfenniak approved these changes 2026-01-15 01:55:16 +00:00
Contributor

cascading-pr updated at actions/setup-forgejo#831

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/831
Owner

Thanks for the fix. 👍

Thanks for the fix. 👍
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1293
No description provided.