-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): add YAML and GitHub Actions lint analysis for PRs #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,678
−1
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
274b868
feat(ci): add YAML and GitHub Actions lint analysis for PRs
bedatty 29ec34c
fix(ci): scope yamllint and actionlint to changed files only
bedatty 3d80351
fix(ci): register blacksmith runner label for actionlint
bedatty 4e446f5
feat(ci): add pinned actions check, markdown link check, typos, and s…
bedatty 49cd047
refactor(ci): merge self-pr-analysis into self-pr-validation
bedatty b7f000d
feat(lint): add lint composites and refactor self-pr-validation
bedatty 9a69bfb
feat(config): extract changed-workflows composite from self-pr-valida…
bedatty b492d3c
fix(ci): add changed-files dependency to typos job
bedatty f334a50
fix(config): fix find operator precedence and require github-token in…
bedatty e35c14b
feat(lint): add step summaries to all lint and detection composites
bedatty dde24f4
refactor(lint): replace step summaries with log output in lint compos…
bedatty b04d411
refactor(lint): add file count and list to log step in lint composites
bedatty 71a64ce
refactor(lint): use group annotations and sed for file log in lint co…
bedatty 7770a1c
fix(changed-workflows): replace while loop with sed to fix step summa…
bedatty 53c4beb
fix(lint): action-files csv, actionlint covers src/ composites, log c…
bedatty 830e2f6
feat(notify): add pr-lint-reporter composite and lint-report job to p…
bedatty 1be31df
refactor(notify): replace files collapse with failures collapse in pr…
bedatty a97179d
feat(lint): scope spelling check to changed files only, add all-files…
bedatty ec3908f
feat(notify): fetch job annotations to show per-file errors in failur…
bedatty d5b0f2e
fix(lint): use env vars for input interpolation in run blocks, fix gr…
bedatty 279fb61
fix(lint): scope actionlint to workflow files only to avoid composite…
bedatty ad251f9
fix(notify): filter only failure-level annotations in lint reporter t…
bedatty fae22b3
chore(deps): upgrade actions/checkout to v6 in self-pr-validation
bedatty d8f0c23
feat(lint): enforce full semver pinning in pinned-actions check
bedatty 2cae85a
feat(lint): warn on internal unpinned actions instead of failing in p…
bedatty 2056850
feat(lint): restrict external actions to final releases only, allow p…
bedatty b260707
feat(lint): warn on internal pre-release tags (beta/rc) instead of al…
bedatty cde8430
fix(lint): anchor uses: grep to start of line to avoid false matches …
bedatty 34f1df0
fix(lint): align pinned-actions description and error message with ac…
bedatty 156d6d9
chore(lint): clean up markdown-link-check and yamllint configs
bedatty fff0a94
ci(self): remove edited trigger to prevent reruns on CodeRabbit updates
bedatty 2f653c0
fix(lint): tighten markdown config, fix pinned-actions grep pattern, …
bedatty c489cdb
fix(lint): add pull-requests read to changed-files job, strip inline …
bedatty ed313b6
feat(lint): add shellcheck and readme-check composites to PR lint pip…
bedatty 45b99b0
fix(lint): quote shellcheck description, add pr-lint-reporter README
bedatty db6baab
fix(lint): quote step name containing run: in shellcheck composite
bedatty 2a51bbc
fix(lint): remove GHA expression syntax from Python comment in shellc…
bedatty 7906317
fix(lint): use shell variable placeholder for GHA expressions, exclud…
bedatty 24a5ddf
fix(lint): respect shell type and count all severity findings in shel…
bedatty 6ade279
fix(lint): fix GHA regex for nested braces, correct shellcheck line o…
bedatty 81f4a9d
feat(lint): add composite-schema lint to validate input conventions
bedatty 4691736
fix(lint): scope composite-schema to src/ action files only via dedic…
bedatty c2f8b05
feat(lint): extend composite-schema with name, description, steps, ke…
bedatty feecc51
feat(lint): validate composite directory depth matches src/<capabilit…
bedatty cba4fd8
fix(lint): apply directory depth check only after confirming composit…
bedatty 152be7c
fix(lint): gate validation job to PR events, harden composite-schema …
bedatty 6a50cce
fix(lint): add actions:read permission, harden composite-schema type …
bedatty cfa10e4
fix(lint): fix inputs normalization false-negative and double-count, …
bedatty 94766c0
fix(lint): treat YAML parse errors as violations, enforce action.yml …
bedatty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| self-hosted-runner: | ||
| labels: | ||
| - blacksmith-4vcpu-ubuntu-2404 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "ignorePatterns": [ | ||
| { | ||
| "pattern": "^https://github\\.com/LerianStudio/github-actions-shared-workflows/actions/runs/" | ||
| }, | ||
| { | ||
| "pattern": "^https://github\\.com/LerianStudio/github-actions-shared-workflows/pull/" | ||
| }, | ||
| { | ||
| "pattern": "^https://github\\.com/<" | ||
| } | ||
| ], | ||
| "httpHeaders": [ | ||
| { | ||
| "urls": ["https://github.com"], | ||
| "headers": { | ||
| "Accept-Encoding": "br, gzip, deflate" | ||
| } | ||
| } | ||
| ], | ||
| "timeout": "10s", | ||
| "retryOn429": true, | ||
| "retryCount": 3, | ||
| "fallbackRetryDelay": "5s", | ||
| "aliveStatusCodes": [200, 206, 301, 302, 307, 308] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,214 @@ | ||
| name: Self — PR Validation | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
| - main | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| - reopened | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: read | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| jobs: | ||
| # ----------------- PR Validation ----------------- | ||
| validation: | ||
| if: github.event_name == 'pull_request' | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| checks: read | ||
| uses: ./.github/workflows/pr-validation.yml | ||
| with: | ||
| check_changelog: false | ||
| enforce_source_branches: true | ||
| allowed_source_branches: "develop|hotfix/*" | ||
| target_branches_for_source_check: "main" | ||
| secrets: inherit | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # ----------------- Changed Files Detection ----------------- | ||
| changed-files: | ||
| name: Detect Changed Files | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| outputs: | ||
| yaml_files: ${{ steps.detect.outputs.yaml-files }} | ||
| workflow_files: ${{ steps.detect.outputs.workflow-files }} | ||
| action_files: ${{ steps.detect.outputs.action-files }} | ||
| composite_files: ${{ steps.detect.outputs.composite-files }} | ||
| markdown_files: ${{ steps.detect.outputs.markdown-files }} | ||
| all_files: ${{ steps.detect.outputs.all-files }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Detect changed files | ||
| id: detect | ||
| uses: ./src/config/changed-workflows | ||
| with: | ||
| github-token: ${{ github.token }} | ||
|
|
||
| # ----------------- YAML Lint ----------------- | ||
| yamllint: | ||
| name: YAML Lint | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.yaml_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: YAML Lint | ||
| uses: ./src/lint/yamllint | ||
| with: | ||
| file-or-dir: ${{ needs.changed-files.outputs.yaml_files }} | ||
|
|
||
| # ----------------- Action Lint ----------------- | ||
| actionlint: | ||
| name: Action Lint | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.workflow_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Action Lint | ||
| uses: ./src/lint/actionlint | ||
| with: | ||
| files: ${{ needs.changed-files.outputs.workflow_files }} | ||
|
|
||
| # ----------------- Pinned Actions Check ----------------- | ||
| pinned-actions: | ||
| name: Pinned Actions Check | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.action_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Pinned Actions Check | ||
| uses: ./src/lint/pinned-actions | ||
| with: | ||
| files: ${{ needs.changed-files.outputs.action_files }} | ||
bedatty marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # ----------------- Markdown Link Check ----------------- | ||
| markdown-link-check: | ||
| name: Markdown Link Check | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.markdown_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Markdown Link Check | ||
| uses: ./src/lint/markdown-link-check | ||
| with: | ||
| file-path: ${{ needs.changed-files.outputs.markdown_files }} | ||
|
|
||
| # ----------------- Spelling Check ----------------- | ||
| typos: | ||
| name: Spelling Check | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.all_files != '' | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Spelling Check | ||
| uses: ./src/lint/typos | ||
bedatty marked this conversation as resolved.
Show resolved
Hide resolved
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with: | ||
| files: ${{ needs.changed-files.outputs.all_files }} | ||
|
|
||
| # ----------------- Shell Check ----------------- | ||
| shellcheck: | ||
| name: Shell Check | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.action_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Shell Check | ||
| uses: ./src/lint/shellcheck | ||
| with: | ||
| files: ${{ needs.changed-files.outputs.action_files }} | ||
|
|
||
| # ----------------- README Check ----------------- | ||
| readme-check: | ||
| name: README Check | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.action_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: README Check | ||
| uses: ./src/lint/readme-check | ||
| with: | ||
| files: ${{ needs.changed-files.outputs.action_files }} | ||
|
|
||
| # ----------------- Composite Schema Lint ----------------- | ||
| composite-schema: | ||
| name: Composite Schema Lint | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| needs: changed-files | ||
| if: needs.changed-files.outputs.composite_files != '' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Composite Schema Lint | ||
| uses: ./src/lint/composite-schema | ||
| with: | ||
| files: ${{ needs.changed-files.outputs.composite_files }} | ||
|
|
||
| # ----------------- Lint Report ----------------- | ||
| lint-report: | ||
| name: Lint Report | ||
| runs-on: blacksmith-4vcpu-ubuntu-2404 | ||
| permissions: | ||
| actions: read | ||
| contents: read | ||
| pull-requests: write | ||
| issues: write | ||
| checks: read | ||
| needs: [changed-files, yamllint, actionlint, pinned-actions, markdown-link-check, typos, shellcheck, readme-check, composite-schema] | ||
| if: always() && github.event_name == 'pull_request' && needs.changed-files.result == 'success' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Post Lint Report | ||
| uses: ./src/notify/pr-lint-reporter | ||
| with: | ||
| github-token: ${{ secrets.MANAGE_TOKEN || github.token }} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| yamllint-result: ${{ needs.yamllint.result }} | ||
| yamllint-files: ${{ needs.changed-files.outputs.yaml_files }} | ||
| actionlint-result: ${{ needs.actionlint.result }} | ||
| actionlint-files: ${{ needs.changed-files.outputs.workflow_files }} | ||
| pinned-actions-result: ${{ needs.pinned-actions.result }} | ||
| pinned-actions-files: ${{ needs.changed-files.outputs.action_files }} | ||
| markdown-result: ${{ needs.markdown-link-check.result }} | ||
| markdown-files: ${{ needs.changed-files.outputs.markdown_files }} | ||
| typos-result: ${{ needs.typos.result }} | ||
| typos-files: ${{ needs.changed-files.outputs.all_files }} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| shellcheck-result: ${{ needs.shellcheck.result }} | ||
| shellcheck-files: ${{ needs.changed-files.outputs.action_files }} | ||
| readme-result: ${{ needs.readme-check.result }} | ||
| readme-files: ${{ needs.changed-files.outputs.action_files }} | ||
| composite-schema-result: ${{ needs.composite-schema.result }} | ||
| composite-schema-files: ${{ needs.changed-files.outputs.composite_files }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| extends: default | ||
|
|
||
| rules: | ||
| # GitHub Actions uses bare `on:` as top-level key — avoid truthy false positives | ||
| truthy: | ||
| allowed-values: ["true", "false"] | ||
| check-keys: false | ||
|
|
||
| # Workflow files have long run: blocks and action refs | ||
| line-length: | ||
| max: 200 | ||
| level: warning | ||
|
|
||
| indentation: | ||
| spaces: 2 | ||
| indent-sequences: whatever | ||
|
|
||
| # Not enforcing leading `---` — optional in workflow files | ||
| document-start: disable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <table border="0" cellspacing="0" cellpadding="0"> | ||
| <tr> | ||
| <td><img src="https://github.com/LerianStudio.png" width="72" alt="Lerian" /></td> | ||
| <td><h1>changed-workflows</h1></td> | ||
| </tr> | ||
| </table> | ||
|
|
||
| Detect changed files in a pull request and categorize them by type for downstream lint jobs. | ||
|
|
||
| ## Outputs | ||
|
|
||
| | Output | Format | Description | | ||
| |--------|--------|-------------| | ||
| | `yaml-files` | Space-separated | All changed `.yml` files | | ||
| | `workflow-files` | Comma-separated | Changed `.github/workflows/*.yml` files | | ||
| | `action-files` | Space-separated | Changed workflow and composite `.yml`/`.yaml` files | | ||
| | `markdown-files` | Comma-separated | Changed `.md` files | | ||
|
|
||
| On `workflow_dispatch`, falls back to scanning the full repository. | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Description | Required | Default | | ||
| |-------|-------------|----------|---------| | ||
| | `github-token` | GitHub token for `gh` CLI access | No | `""` | | ||
|
|
||
| ## Usage as composite step | ||
|
|
||
| ```yaml | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Detect changed files | ||
| id: changed | ||
| uses: LerianStudio/github-actions-shared-workflows/src/config/changed-workflows@v1.2.3 | ||
| with: | ||
| github-token: ${{ github.token }} | ||
|
|
||
| - name: YAML Lint | ||
| if: steps.changed.outputs.yaml-files != '' | ||
| uses: LerianStudio/github-actions-shared-workflows/src/lint/yamllint@v1.2.3 | ||
| with: | ||
| file-or-dir: ${{ steps.changed.outputs.yaml-files }} | ||
| ``` | ||
| ## Required permissions | ||
| ```yaml | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.