-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (50 loc) · 2.71 KB
/
yaml-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Name of the GitHub Actions workflow, shown in the GitHub UI
name: YAML Lint
# Defines the events that trigger the workflow
on:
# Trigger the workflow when code is pushed to the repository
push:
# Defines which branches to monitor
branches:
- main # Runs the action on pushes to the 'main' branch
# Runs only if files matching these paths are changed inside .github/workflows folder
paths:
- ".github/workflows/**/*.yaml" # Lint files with the '.yaml' extension inside the .github/workflows folder
- ".github/workflows/**/*.yml" # Lint files with the '.yml' extension inside the .github/workflows folder
# Trigger the workflow on pull requests
pull_request:
# Defines which branches to monitor for pull requests
branches:
- main # Runs the action on pull requests targeting the 'main' branch
# Runs only if files matching these paths are changed inside .github/workflows folder
paths:
- ".github/workflows/**/*.yaml" # Lint files with the '.yaml' extension inside the .github/workflows folder
- ".github/workflows/**/*.yml" # Lint files with the '.yml' extension inside the .github/workflows folder
# Allows manual triggering of the workflow via the GitHub UI
workflow_dispatch:
# Defines the jobs to be run in the workflow
jobs:
# Job name, you can reference this in other parts of the workflow
lintYamlFiles:
# Specifies the runner environment for the job (Ubuntu in this case)
runs-on: ubuntu-latest
steps: # List of steps to be executed in the job
# Step name, shown in the GitHub UI
- name: Checkout code
# Action to check out the repository’s code, so it can be accessed by subsequent steps
uses: actions/checkout@v3
# Step name, shown in the GitHub UI
- name: Lint all YAML files in .github/workflows folder
# Action to run yamllint on the YAML files inside the .github/workflows folder
uses: ibiqlik/action-yamllint@v3
with: # Provides additional configuration to the yamllint action
# Lint all YAML files with '.yaml' extension inside the .github/workflows folder
file_or_dir: ".github/workflows/**/*.yaml"
format: "github" # Specifies the output format to be GitHub-friendly annotations for easier viewing in the GitHub UI
# Lint all YML files inside .github/workflows folder
- name: Lint all YML files in .github/workflows folder
uses: ibiqlik/action-yamllint@v3
with:
# Lint all YAML files with '.yml' extension inside the .github/workflows folder
file_or_dir: ".github/workflows/**/*.yml"
format: "github" # Specifies the output format to be GitHub-friendly annotations for easier viewing in the GitHub UI