feat: add artifact api from gitea server (#103)
add action api for artifacts upload and download. It's related to https://github.com/go-gitea/gitea/pull/22738 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/103 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: fuxiaohei <fuxiaohei@vip.qq.com> Co-committed-by: fuxiaohei <fuxiaohei@vip.qq.com>
This commit is contained in:
parent
9c6499ec08
commit
b79c3aa1a3
1 changed files with 8 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -60,6 +61,10 @@ func NewRunner(cfg *config.Config, reg *config.Registration, cli client.Client)
|
|||
}
|
||||
}
|
||||
|
||||
// set artifact gitea api
|
||||
artifactGiteaAPI := strings.TrimSuffix(cli.Address(), "/") + "/api/actions_pipeline/"
|
||||
envs["ACTIONS_RUNTIME_URL"] = artifactGiteaAPI
|
||||
|
||||
return &Runner{
|
||||
name: reg.Name,
|
||||
cfg: cfg,
|
||||
|
@ -149,6 +154,9 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report.
|
|||
preset.Token = t
|
||||
}
|
||||
|
||||
// use task token to action api token
|
||||
r.envs["ACTIONS_RUNTIME_TOKEN"] = preset.Token
|
||||
|
||||
eventJSON, err := json.Marshal(preset.Event)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue