@@ -69,19 +69,29 @@ func NewRunner(t *testing.T) (*Runner, error) {
6969}
7070
7171// args returns the CLI arguments to pass to act for the given workflow and event payload files.
72- func (r * Runner ) args (workflowFile string , payloadFile string ) []string {
72+ func (r * Runner ) args (workflowFile string , payloadFile string ) ( []string , error ) {
7373 pciwfRoot , err := os .Getwd ()
7474 if err != nil {
75- // TODO: do not fail silently
76- pciwfRoot = ""
75+ return nil , fmt .Errorf ("get working directory: %w" , err )
7776 }
77+ f , err := os .Open (".release-please-manifest.json" )
78+ if err != nil {
79+ return nil , fmt .Errorf ("open .release-please-manifest.json: %w" , err )
80+ }
81+ defer f .Close ()
82+ var releasePleaseManifest map [string ]string
83+ if err := json .NewDecoder (f ).Decode (& releasePleaseManifest ); err != nil {
84+ return nil , fmt .Errorf ("decode release-please-config.json: %w" , err )
85+ }
86+ releasePleaseTag := "ci-cd-workflows/" + "v" + releasePleaseManifest [".github/workflows" ]
7887 args := []string {
7988 "-W" , workflowFile ,
8089 "-e" , payloadFile ,
8190 "--rm" ,
8291 "--json" ,
8392 "--artifact-server-path=/tmp/artifacts/" ,
8493 "--local-repository=grafana/plugin-ci-workflows@main=" + pciwfRoot ,
94+ "--local-repository=grafana/plugin-ci-workflows@" + releasePleaseTag + "=" + pciwfRoot ,
8595 "--secret" , "GITHUB_TOKEN=" + r .gitHubToken ,
8696 }
8797 if r .ConcurrentJobs > 0 {
@@ -91,7 +101,7 @@ func (r *Runner) args(workflowFile string, payloadFile string) []string {
91101 for _ , label := range selfHostedRunnerLabels {
92102 args = append (args , "-P" , label + "=" + nektosActRunnerImage )
93103 }
94- return args
104+ return args , nil
95105}
96106
97107// Run runs the given workflow with the given event payload using act.
@@ -111,7 +121,10 @@ func (r *Runner) Run(workflow workflow.Marshalable, eventPayload EventPayload) e
111121 }
112122 defer os .Remove (payloadFile )
113123
114- args := r .args (workflowFile , payloadFile )
124+ args , err := r .args (workflowFile , payloadFile )
125+ if err != nil {
126+ return fmt .Errorf ("get act args: %w" , err )
127+ }
115128
116129 // TODO: escape args to avoid shell injection
117130 actCmd := "act " + strings .Join (args , " " )
0 commit comments