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 87392c2ed7
commit 15fb58bf43
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)
}