Skip to content

Commit

Permalink
Add GitHub Actions workflow for linting YAML files
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
KenEkanem authored and Kennedy Ekanem committed Oct 21, 2024
1 parent f2b31d1 commit 3a8f9ea
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/lint-workflow-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Validates all workflow files on PR changes

name: Lint Workflow Files
on:
pull_request:
paths:
- '.github/workflows/**/*.yml'

jobs:
lint-workflows:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install yamllint
run: pip install yamllint

- name: Run YAML syntax check
run: yamllint .github/workflows/*.yml

- name: Run Actions-specific checks
uses: reviewdog/action-actionlint@v1

- name: Reminder to Fix Errors
if: failure()
run: echo "Please ensure all linting errors are addressed before merging the pull request."

0 comments on commit 3a8f9ea

Please sign in to comment.