diff options
author | Ryan <me@hackerc.at> | 2021-09-27 19:33:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 19:33:14 +0200 |
commit | 7a426a0f37d21e32a01e85d9403edba17a54d545 (patch) | |
tree | 94042c8c0708146f95ec4948cae98f15ae23bf32 | |
parent | build(deps): bump github.com/joho/godotenv from 1.3.0 to 1.4.0 (#824) (diff) | |
download | forgejo-act-7a426a0f37d21e32a01e85d9403edba17a54d545.tar.xz forgejo-act-7a426a0f37d21e32a01e85d9403edba17a54d545.zip |
refactor: re-implement `embed` without "unused" import (#830)
* refactor: re-implement `embed` without "unused" import
* fix(gitignore): ignore local docker registry data
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | pkg/runner/step_context.go | 14 |
2 files changed, 11 insertions, 6 deletions
@@ -28,3 +28,6 @@ coverage.txt .env .secrets + +# ignore docker registry from .github/workflows/checks.yml +docker-registry/ diff --git a/pkg/runner/step_context.go b/pkg/runner/step_context.go index baa88a5..a33db58 100644 --- a/pkg/runner/step_context.go +++ b/pkg/runner/step_context.go @@ -3,11 +3,9 @@ package runner import ( "archive/tar" "context" - "io" - - // Go told me to? - _ "embed" + "embed" "fmt" + "io" "io/ioutil" "os" "path" @@ -335,7 +333,7 @@ func (sc *StepContext) runUsesContainer() common.Executor { } //go:embed res/trampoline.js -var trampoline []byte +var trampoline embed.FS func (sc *StepContext) setupAction(actionDir string, actionPath string, localAction bool) common.Executor { return func(ctx context.Context) error { @@ -378,7 +376,11 @@ func (sc *StepContext) setupAction(actionDir string, actionPath string, localAct } if sc.Step.With != nil { if val, ok := sc.Step.With["args"]; ok { - err2 := ioutil.WriteFile(filepath.Join(actionDir, actionPath, "trampoline.js"), trampoline, 0400) + var b []byte + if b, err = trampoline.ReadFile("res/trampoline.js"); err != nil { + return err + } + err2 := ioutil.WriteFile(filepath.Join(actionDir, actionPath, "trampoline.js"), b, 0400) if err2 != nil { return err } |