← 全部工具

suzuki-shunsuke/ghatm

热度 65 更新于 开发与构建

Set timeout-minutes to all GitHub Actions jobs

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

ghatm

ghatm is a command line tool setting timeout-minutes to all GitHub Actions jobs. It finds GitHub Actions workflows and adds timeout-minutes to jobs which don't have the setting. It edits workflow files while keeping YAML comments, indents, empty lines, and so on.

$ ghatm set
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index e8c6ae7..aba3b2d 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -6,6 +6,7 @@ on: pull_request
 jobs:
   path-filter:
     # Get changed files to filter jobs
+    timeout-minutes: 30
     outputs:
       update-aqua-checksums: ${{steps.changes.outputs.update-aqua-checksums}}
       renovate-config-validator: ${{steps.changes.outputs.renovate-config-validator}}

contents: read

build:

  • timeout-minutes: 30

runs-on: ubuntu-latest permissions: {} steps:


## Motivation

- https://exercism.org/docs/building/github/gha-best-practices#h-set-timeouts-for-workflows
- [job_timeout_minutes_is_required | suzuki-shunsuke/ghalint](https://github.com/suzuki-shunsuke/ghalint/blob/main/docs/policies/012.md)
- [job_timeout_minutes_is_required | lintnet-modules/ghalint](https://github.com/lintnet-modules/ghalint/tree/main/workflow/job_timeout_minutes_is_required)

`timeout-minutes` should be set properly, but it's so bothersome to fix a lot of workflow files by hand.
`ghatm` fixes them automatically.

## How to install

So you only need to put the executable binary into $PATH.

  • Homebrew
brew install suzuki-shunsuke/ghatm/ghatm
  • Scoop
scoop bucket add suzuki-shunsuke https://github.com/suzuki-shunsuke/scoop-bucket
scoop install ghatm
  • aqua
aqua g -i suzuki-shunsuke/ghatm
  • Download a prebuilt binary from GitHub Releases and install it into $PATH

<details <summaryVerify downloaded assets from GitHub Releases</summary