1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

feat: add FORGEJO_* for each GITHUB_* in the environment & contexts (#171)

Blocking for

- https://code.forgejo.org/actions/setup-forgejo/pulls/461
- forgejo/end-to-end#758

Tested locally with both of them.

```
$ ./end-to-end.sh actions_teardown
$ ( cd ../runner ; make --always-make forgejo-runner ; cp forgejo-runner /tmp/forgejo-end-to-end/forgejo-runner )
$ ./end-to-end.sh actions_setup 12.0
$ ./end-to-end.sh actions_verify_example conext
```

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/171
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-07 06:00:53 +00:00 committed by earl-warren
parent 1a5cda1a93
commit aaf05691c0
2 changed files with 44 additions and 36 deletions

View file

@ -107,20 +107,26 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
// Prepare and clean Runner File Commands
actPath := rc.JobContainer.GetActPath()
set := func(k, v string) {
for _, prefix := range []string{"FORGEJO", "GITHUB"} {
(*step.getEnv())[prefix+"_"+k] = v
}
}
outputFileCommand := path.Join("workflow", "outputcmd.txt")
(*step.getEnv())["GITHUB_OUTPUT"] = path.Join(actPath, outputFileCommand)
set("OUTPUT", path.Join(actPath, outputFileCommand))
stateFileCommand := path.Join("workflow", "statecmd.txt")
(*step.getEnv())["GITHUB_STATE"] = path.Join(actPath, stateFileCommand)
set("STATE", path.Join(actPath, stateFileCommand))
pathFileCommand := path.Join("workflow", "pathcmd.txt")
(*step.getEnv())["GITHUB_PATH"] = path.Join(actPath, pathFileCommand)
set("PATH", path.Join(actPath, pathFileCommand))
envFileCommand := path.Join("workflow", "envs.txt")
(*step.getEnv())["GITHUB_ENV"] = path.Join(actPath, envFileCommand)
set("ENV", path.Join(actPath, envFileCommand))
summaryFileCommand := path.Join("workflow", "SUMMARY.md")
(*step.getEnv())["GITHUB_STEP_SUMMARY"] = path.Join(actPath, summaryFileCommand)
set("STEP_SUMMARY", path.Join(actPath, summaryFileCommand))
_ = rc.JobContainer.Copy(actPath, &container.FileEntry{
Name: outputFileCommand,