refactor: re-implement embed
without "unused" import (#830)
* refactor: re-implement `embed` without "unused" import * fix(gitignore): ignore local docker registry data
This commit is contained in:
parent
bfcf0abd73
commit
7a426a0f37
2 changed files with 11 additions and 6 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -28,3 +28,6 @@ coverage.txt
|
||||||
|
|
||||||
.env
|
.env
|
||||||
.secrets
|
.secrets
|
||||||
|
|
||||||
|
# ignore docker registry from .github/workflows/checks.yml
|
||||||
|
docker-registry/
|
||||||
|
|
|
@ -3,11 +3,9 @@ package runner
|
||||||
import (
|
import (
|
||||||
"archive/tar"
|
"archive/tar"
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"embed"
|
||||||
|
|
||||||
// Go told me to?
|
|
||||||
_ "embed"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -335,7 +333,7 @@ func (sc *StepContext) runUsesContainer() common.Executor {
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed res/trampoline.js
|
//go:embed res/trampoline.js
|
||||||
var trampoline []byte
|
var trampoline embed.FS
|
||||||
|
|
||||||
func (sc *StepContext) setupAction(actionDir string, actionPath string, localAction bool) common.Executor {
|
func (sc *StepContext) setupAction(actionDir string, actionPath string, localAction bool) common.Executor {
|
||||||
return func(ctx context.Context) error {
|
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 sc.Step.With != nil {
|
||||||
if val, ok := sc.Step.With["args"]; ok {
|
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 {
|
if err2 != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue