Skip to content

Commit

Permalink
Add timout-minutes to Github Actions workflows (mlflow#14101) (mlflow…
Browse files Browse the repository at this point in the history
…#14121)

Signed-off-by: Leah Korol <[email protected]>
Signed-off-by: harupy <[email protected]>
Co-authored-by: harupy <[email protected]>
  • Loading branch information
LeahKorol and harupy authored Dec 19, 2024
1 parent 6ad165e commit d638d82
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/policy.rego
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,24 @@ deny_unnecessary_github_token[msg] {
msg := "Unnecessary use of github-token for actions/github-script."
}

deny_jobs_without_timeout[msg] {
jobs_without_timeout := get_jobs_without_timeout(input.jobs)
count(jobs_without_timeout) > 0
msg := sprintf("The following jobs are missing timeout-minutes: %s",
[concat(", ", jobs_without_timeout)])
}

########################### RULE HELPERS ##################################
get_jobs_without_permissions(jobs) = jobs_without_permissions {
jobs_without_permissions := { job_id |
job := jobs[job_id]
not job["permissions"]
}
}

get_jobs_without_timeout(jobs) = jobs_without_timeout {
jobs_without_timeout := { job_id |
job := jobs[job_id]
not job["timeout-minutes"]
}
}
1 change: 1 addition & 0 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ jobs:
runs-on: ubuntu-latest
needs: devcontainer
if: github.event_name == 'push'
timeout-minutes: 60
permissions:
packages: write # to push to ghcr.io
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
js:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
permissions: {}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/maintainer-approval.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
jobs:
check:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
pull-requests: read
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/recipe-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ jobs:
cd ${{ github.event.inputs.repository }} && pytest tests --rootdir .
recipe-windows:
runs-on: windows-latest
timeout-minutes: 120
permissions: {}
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/recipe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
recipes-windows:
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: windows-latest
timeout-minutes: 120
permissions: {}
strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/team-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
review:
runs-on: ubuntu-latest
if: ${{ github.event.requested_reviewer.login == 'mlflow-automation'}}
timeout-minutes: 5
permissions:
pull-requests: write
steps:
Expand Down

0 comments on commit d638d82

Please sign in to comment.