WIP: fix: use token to clone actions from local instance #855

Closed
hailey wants to merge 1 commit from hailey/runner:local-instance-clone-token into main
First-time contributor

This PR supersedes #816 with @earl-warren's kind support. It depends on https://codeberg.org/forgejo/forgejo/pulls/8889 upstream

  • other
    • PR: WIP: fix: use token to clone actions from local instance
This PR supersedes https://code.forgejo.org/forgejo/runner/pulls/816 with @earl-warren's kind support. It depends on https://codeberg.org/forgejo/forgejo/pulls/8889 upstream <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - other - [PR](https://code.forgejo.org/forgejo/runner/pulls/855): <!--number 855 --><!--line 0 --><!--description V0lQOiBmaXg6IHVzZSB0b2tlbiB0byBjbG9uZSBhY3Rpb25zIGZyb20gbG9jYWwgaW5zdGFuY2U=-->WIP: fix: use token to clone actions from local instance<!--description--> <!--end release-notes-assistant-->
Contributor

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

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/600
hailey force-pushed local-instance-clone-token from fcc055ae84
Some checks failed
checks / build and test (pull_request) Failing after 58s
checks / runner exec tests (pull_request) Has been skipped
/ cascade (pull_request_target) Failing after 16m33s
act / unit (pull_request) Successful in 4m3s
act / integration (pull_request) Successful in 10m49s
to 78f63be201
Some checks failed
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Failing after 58s
checks / runner exec tests (pull_request) Has been skipped
/ cascade (pull_request_target) Failing after 15m24s
act / unit (pull_request) Successful in 4m8s
act / integration (pull_request) Failing after 10m18s
2025-08-14 10:32:54 +00:00
Compare
Contributor

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

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/600
hailey changed title from WIP: fix: use token to clone actions from local instance to WIP: fix: use token to clone actions from local instance [skip cascade] 2025-08-14 10:33:23 +00:00
Author
First-time contributor

I see what [skip cascade] does now 😁 sorry about that

I see what `[skip cascade]` does now 😁 sorry about that
Contributor

It is fine really.

It is fine really.
Contributor

@hailey do you need anything? I mean beside time to work on that 😁

@hailey do you need anything? I mean beside time to work on that 😁
Contributor

@hailey gentle ping. If you have no time to complete this, please say so 🙏

@hailey gentle ping. If you have no time to complete this, please say so 🙏
hailey force-pushed local-instance-clone-token from 78f63be201
Some checks failed
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Failing after 58s
checks / runner exec tests (pull_request) Has been skipped
/ cascade (pull_request_target) Failing after 15m24s
act / unit (pull_request) Successful in 4m8s
act / integration (pull_request) Failing after 10m18s
to 00d12ac197
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
checks / validate pre-commit-hooks file (pull_request) Successful in 42s
checks / validate mocks (pull_request) Successful in 1m3s
checks / build and test (pull_request) Successful in 3m9s
checks / runner exec tests (pull_request) Successful in 31s
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / runner integration tests (pull_request) Successful in 4m58s
checks / integration tests (pull_request) Failing after 10m56s
2025-09-25 06:47:22 +00:00
Compare
hailey changed title from WIP: fix: use token to clone actions from local instance [skip cascade] to fix: use token to clone actions from local instance [skip cascade] 2025-09-25 06:52:36 +00:00
Author
First-time contributor

Hi! Sorry for the latency. I've rebased this branch against main, fixed that lint error, and tested that it works as expected in my own deployment against Forgejo v12.0.4+forgejo#8889.

It looks like all of the tests have passed except for one of the integration tests, which looks unrelated enough to this change that I think it's a flakey failure. I don't have access to re-run the build though. Other than that, I think we should be good to go here. Thanks again for your patience

Hi! Sorry for the latency. I've rebased this branch against main, fixed that lint error, and tested that it works as expected in my own deployment against Forgejo v12.0.4+[forgejo#8889](https://codeberg.org/forgejo/forgejo/pulls/8889). It looks like all of the tests have passed except for one of the integration tests, which looks unrelated enough to this change that I think it's a flakey failure. I don't have access to re-run the build though. Other than that, I think we should be good to go here. Thanks again for your patience
hailey force-pushed local-instance-clone-token from 00d12ac197
Some checks failed
cascade / forgejo (pull_request_target) Has been skipped
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Has been skipped
checks / validate pre-commit-hooks file (pull_request) Successful in 42s
checks / validate mocks (pull_request) Successful in 1m3s
checks / build and test (pull_request) Successful in 3m9s
checks / runner exec tests (pull_request) Successful in 31s
issue-labels / release-notes (pull_request_target) Successful in 5s
checks / runner integration tests (pull_request) Successful in 4m58s
checks / integration tests (pull_request) Failing after 10m56s
to f70de1ec5a
All checks were successful
checks / validate pre-commit-hooks file (pull_request) Successful in 32s
checks / validate mocks (pull_request) Successful in 41s
checks / build and test (pull_request) Successful in 48s
checks / runner exec tests (pull_request) Successful in 25s
checks / runner integration tests (pull_request) Successful in 4m18s
checks / integration tests (pull_request) Successful in 11m21s
issue-labels / release-notes (pull_request_target) Successful in 10s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 4s
cascade / forgejo (pull_request_target) Successful in 1m0s
2025-09-25 07:05:03 +00:00
Compare
@ -111,0 +114,4 @@
if strings.HasPrefix(cloneURL, gitInstance+"/") {
// only provide clone token if the action is on the same instance
// which triggered the task
token = sar.RunContext.Config.GetToken()
Owner

what happened if you run this runner version against forgejo < v13 ?

what happened if you run this runner version against forgejo < v13 ?
Author
First-time contributor

Good catch - it won't be able to access public repositories anymore due to the strict task.RepoID == repo.ID check in Forgejo < 13. I don't think there's much we can do about this. Since these are pretty tightly coupled pieces of software anyway, maybe we just document that whichever version of the runner this lands in requires at least Forgejo 13

Good catch - it won't be able to access public repositories anymore due to the strict `task.RepoID == repo.ID` check in Forgejo < 13. I don't think there's much we can do about this. Since these are pretty tightly coupled pieces of software anyway, maybe we just document that whichever version of the runner this lands in requires at least Forgejo 13
Owner

does Forgejo send the version with the job payload? or something else we can use to distinguish support?

does Forgejo send the version with the job payload? or something else we can use to distinguish support?
Owner

otherwise this will need to wait for at least next lts release of Forgejo

otherwise this will need to wait for at least next lts release of Forgejo
Author
First-time contributor

This can wait, I'm happy to keep running my branch deploy until then :)

This can wait, I'm happy to keep running my branch deploy until then :)
earl-warren changed title from fix: use token to clone actions from local instance [skip cascade] to fix: use token to clone actions from local instance 2025-09-26 07:14:55 +00:00
earl-warren changed title from fix: use token to clone actions from local instance to WIP: fix: use token to clone actions from local instance 2025-09-26 07:15:00 +00:00
Contributor

@hailey it should be possible to implement this in a backward compatible way, don't you think?

@hailey it should be possible to implement this in a backward compatible way, don't you think?
Owner

This has been completed in a backwards-compatible method by #1249. Thanks for the work on this issue! I'll close it at this time.

This has been completed in a backwards-compatible method by #1249. Thanks for the work on this issue! I'll close it at this time.
mfenniak closed this pull request 2026-01-01 04:58:57 +00:00
Some checks are pending
checks / validate pre-commit-hooks file (pull_request) Successful in 32s
checks / validate mocks (pull_request) Successful in 41s
Required
Details
checks / build and test (pull_request) Successful in 48s
checks / runner exec tests (pull_request) Successful in 25s
Required
Details
checks / runner integration tests (pull_request) Successful in 4m18s
checks / integration tests (pull_request) Successful in 11m21s
issue-labels / release-notes (pull_request_target) Successful in 10s
cascade / debug (pull_request_target) Has been skipped
Required
Details
cascade / end-to-end (pull_request_target) Successful in 4s
Required
Details
cascade / forgejo (pull_request_target) Successful in 1m0s
Required
Details
checks / Build Forgejo Runner *
Required
checks / Run integration tests with *
Required

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 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!855
No description provided.