1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-11 17:50:58 +00:00

fix #134 - include base_ref and head_ref in github context from the event json

This commit is contained in:
Casey Lee 2020-03-06 14:17:57 -08:00
parent 8f6d32db71
commit cc19e1e341
5 changed files with 100 additions and 3 deletions

View file

@ -140,3 +140,40 @@ func TestRunEventSecrets(t *testing.T) {
err = runner.NewPlanExecutor(plan)(ctx)
assert.NilError(t, err, workflowPath)
}
func TestRunEventPullRequest(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
log.SetLevel(log.DebugLevel)
ctx := context.Background()
platforms := map[string]string{
"ubuntu-latest": "node:12.6-buster-slim",
}
workflowPath := "pull-request"
eventName := "pull_request"
workdir, err := filepath.Abs("testdata")
assert.NilError(t, err, workflowPath)
runnerConfig := &Config{
Workdir: workdir,
EventName: eventName,
EventPath: filepath.Join(workdir, workflowPath, "event.json"),
Platforms: platforms,
ReuseContainers: false,
}
runner, err := New(runnerConfig)
assert.NilError(t, err, workflowPath)
planner, err := model.NewWorkflowPlanner(fmt.Sprintf("testdata/%s", workflowPath))
assert.NilError(t, err, workflowPath)
plan := planner.PlanEvent(eventName)
err = runner.NewPlanExecutor(plan)(ctx)
assert.NilError(t, err, workflowPath)
}