feat: add pre-commit hook for validator (#1002)
This will allow users to validate their Forgejo Actions files (both actions and workflows) prior to committing them to their repositories, using a `pre-commit` configuration similar to ```yaml - repo: https://code.forgejo.org/forgejo/runner rev: v11.1.0 hooks: - id: forgejo-runner-validate ``` <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - features - [PR](https://code.forgejo.org/forgejo/runner/pulls/1002): <!--number 1002 --><!--line 0 --><!--description ZmVhdDogYWRkIHByZS1jb21taXQgaG9vayBmb3IgdmFsaWRhdG9y-->feat: add pre-commit hook for validator<!--description--> <!--end release-notes-assistant--> Co-authored-by: Frederik “Freso” S. Olesen <freso.dk@gmail.com> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1002 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Co-authored-by: Freso <freso@noreply.code.forgejo.org> Co-committed-by: Freso <freso@noreply.code.forgejo.org>
This commit is contained in:
parent
b8ab05e367
commit
f4eb8e57fb
2 changed files with 66 additions and 0 deletions
16
.pre-commit-hooks.yaml
Normal file
16
.pre-commit-hooks.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
- id: forgejo-runner-validate
|
||||
name: Validate Forgejo Actions files
|
||||
description: This hook validates Forgejo Actions action and workflow files.
|
||||
language: golang
|
||||
entry: runner validate
|
||||
args: ['--directory', '.']
|
||||
pass_filenames: false
|
||||
files: (?:(?:^|/)action|^\.(?:forgejo|github|gitea)/workflows/[^/\n]+)\.ya?ml$
|
||||
types: [yaml]
|
||||
# 3.2.0 is when the pre-* `stages` used here were added.
|
||||
# Old names (without the pre- prefix) are deprecated since 4.0.0.
|
||||
minimum_pre_commit_version: '3.2.0'
|
||||
stages: [pre-commit, pre-merge-commit, pre-push, manual]
|
||||
# validate doesn’t currently provide non-success exit codes,
|
||||
# so falling back to always printing verbose output for now.
|
||||
verbose: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue