Skip to content

Commit

Permalink
Add ubuntu-22 as trusted runner (#291)
Browse files Browse the repository at this point in the history
* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

* update

Signed-off-by: laurentsimon <laurentsimon@google.com>

Signed-off-by: laurentsimon <laurentsimon@google.com>
  • Loading branch information
laurentsimon authored Dec 16, 2022
1 parent 1724732 commit 6dde882
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/server/verify_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ var (
errEmptyStepUses = errors.New("scorecard job must only have steps with `uses`")
)

// TODO(#290): retrieve the runners dynamically.
// List below is from https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners.
var ubuntuRunners = map[string]bool{
"ubuntu-latest": true,
"ubuntu-22.04": true,
"ubuntu-20.04": true,
"ubuntu-18.04": true,
}

func verifyScorecardWorkflow(workflowContent string) error {
// Verify workflow contents using actionlint.
workflow, lintErrs := actionlint.Parse([]byte(workflowContent))
Expand Down Expand Up @@ -90,8 +99,8 @@ func verifyScorecardWorkflow(workflowContent string) error {
if len(labels) != 1 {
return fmt.Errorf("%w", errScorecardJobRunsOn)
}
jobEnv := labels[0].Value
if jobEnv != "ubuntu-latest" && jobEnv != "ubuntu-20.04" && jobEnv != "ubuntu-18.04" {
label := labels[0].Value
if _, ok := ubuntuRunners[label]; !ok {
return fmt.Errorf("%w", errScorecardJobRunsOn)
}

Expand Down

0 comments on commit 6dde882

Please sign in to comment.