Skip to content

Commit 3a8f9ea

Browse files
KenEkanemKennedy Ekanem
authored and
Kennedy Ekanem
committed
Add GitHub Actions workflow for linting YAML files
- This workflow ensures that any YAML files in the .github/workflows directory are checked for syntax and formatting issues using yamllint, and GitHub Actions-specific errors are caught using actionlint. - This will help prevent issues related to incorrect workflows during pull requests. - Added a reminder step to ensure contributors see a message to address all linting errors before merging the pull request.
1 parent f2b31d1 commit 3a8f9ea

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Validates all workflow files on PR changes
2+
3+
name: Lint Workflow Files
4+
on:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/**/*.yml'
8+
9+
jobs:
10+
lint-workflows:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Python
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.x'
20+
21+
- name: Install yamllint
22+
run: pip install yamllint
23+
24+
- name: Run YAML syntax check
25+
run: yamllint .github/workflows/*.yml
26+
27+
- name: Run Actions-specific checks
28+
uses: reviewdog/action-actionlint@v1
29+
30+
- name: Reminder to Fix Errors
31+
if: failure()
32+
run: echo "Please ensure all linting errors are addressed before merging the pull request."

0 commit comments

Comments
 (0)