diff --git a/pkg/runner/action_composite.go b/pkg/runner/action_composite.go index 0fc1fd8..2e36d2e 100644 --- a/pkg/runner/action_composite.go +++ b/pkg/runner/action_composite.go @@ -37,6 +37,9 @@ func evaluateCompositeInputAndEnv(ctx context.Context, parent *RunContext, step env[envKey] = ee.Interpolate(ctx, input.Default) } } + gh := step.getGithubContext(ctx) + env["GITHUB_ACTION_REPOSITORY"] = gh.ActionRepository + env["GITHUB_ACTION_REF"] = gh.ActionRef return env } @@ -53,11 +56,11 @@ func newCompositeRunContext(ctx context.Context, parent *RunContext, step action Name: parent.Name, JobName: parent.JobName, Run: &model.Run{ - JobID: "composite-job", + JobID: parent.Run.JobID, Workflow: &model.Workflow{ Name: parent.Run.Workflow.Name, Jobs: map[string]*model.Job{ - "composite-job": {}, + parent.Run.JobID: {}, }, }, }, diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 51a7c9f..2c55e8a 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -627,6 +627,8 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext Token: rc.Config.Token, Job: rc.Run.JobID, ActionPath: rc.ActionPath, + ActionRepository: rc.Env["GITHUB_ACTION_REPOSITORY"], + ActionRef: rc.Env["GITHUB_ACTION_REF"], RepositoryOwner: rc.Config.Env["GITHUB_REPOSITORY_OWNER"], RetentionDays: rc.Config.Env["GITHUB_RETENTION_DAYS"], RunnerPerflog: rc.Config.Env["RUNNER_PERFLOG"], diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go index 4034e96..8d0ee77 100644 --- a/pkg/runner/runner_test.go +++ b/pkg/runner/runner_test.go @@ -237,6 +237,7 @@ func TestRunEvent(t *testing.T) { {workdir, "uses-composite-with-error", "push", "Job 'failing-composite-action' failed", platforms, secrets}, {workdir, "uses-nested-composite", "push", "", platforms, secrets}, {workdir, "remote-action-composite-js-pre-with-defaults", "push", "", platforms, secrets}, + {workdir, "remote-action-composite-action-ref", "push", "", platforms, secrets}, {workdir, "uses-workflow", "push", "", platforms, map[string]string{"secret": "keep_it_private"}}, {workdir, "uses-workflow", "pull_request", "", platforms, map[string]string{"secret": "keep_it_private"}}, {workdir, "uses-docker-url", "push", "", platforms, secrets}, diff --git a/pkg/runner/testdata/remote-action-composite-action-ref/push.yml b/pkg/runner/testdata/remote-action-composite-action-ref/push.yml new file mode 100644 index 0000000..6587651 --- /dev/null +++ b/pkg/runner/testdata/remote-action-composite-action-ref/push.yml @@ -0,0 +1,8 @@ +name: remote-action-composite-action-ref +on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: nektos/act-test-actions/composite-assert-action-ref-action@main