ci-validate-workflow
Validate GitHub Actions workflow files for syntax, best practices, and correctness. Use before committing workflow changes or when workflows fail.
- Category: discovered
- Tags: github, community
- Version: 1.0.0
- Author: walid
- Downloads: 0
- GitHub stars: 4
- Updated: 2025-11-21
Download the latest version (v1.0.0) from this page.
SKILL.md
---
name: ci-validate-workflow
description: Validate GitHub Actions workflow files for syntax, best practices, and correctness. Use before committing workflow changes or when workflows fail.
---
# CI Workflow Validation Skill
Validate GitHub Actions workflow files.
## When to Use
- Creating new workflow
- Modifying existing workflow
- Workflow syntax errors
- Before committing workflow changes
## Validation Methods
### 1. GitHub CLI
```bash
# View workflow
gh workflow view <workflow-name>
# List workflows
gh workflow list
# Check workflow syntax (via API)
gh api repos/{owner}/{repo}/actions/workflows
```text
### 2. actionlint
```bash
# Install
pip install actionlint
# Validate workflows
actionlint .github/workflows/*.yml
```text
### 3. yamllint
```bash
# Validate YAML syntax
yamllint .github/workflows/*.yml
```text
## Common Issues
### 1. Syntax Errors
```yaml
# ❌ Wrong
on: [push pull_request]
# ✅ Correct
on: [push, pull_request]
```text
### 2. Invalid Actions
```yaml
# ❌ Wrong version
- uses: actions/checkout@v99
# ✅ Correct
- uses: actions/checkout@v4
```text
### 3. Missing Required Fields
```yaml
# ❌ Missing 'runs-on'
jobs:
test:
steps:
- run: echo "test"
# ✅ Complete
jobs:
test:
runs-on: ubuntu-latest
steps:
- run: echo "test"
```text
## Best Practices
- Use specific action versions (@v4, not @main)
- Pin to commit SHA for security
- Use `if` conditions to save CI time
- Set explicit timeouts
- Cache dependencies
Example:
```yaml
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
```text
See GitHub Actions documentation for complete reference.