Add check/fix workflows for YAML files#364
Conversation
|
@greenc-FNAL, the number of checks has gotten very large. Why do we need a YAML check? The action will not run if there's a YAML error, right? Which seems like a chicken-and-egg problem. |
|
Specifically for syntax errors in workflows, yes. It also enforces the usual style bits, like line length, unwanted trailing whitespace and indentation consistency. There are several non-workflow YAML files in the repository rn (tool configurations), but I exepct there will be Phlex configs eventually, also. These single language checks are quite fast (<10s) as long as we don't need a Phlex build environment to run them |
|
@phlexbot yaml-fix |
3de01e7 to
eee154c
Compare
There was a problem hiding this comment.
Pull request overview
Adds repository-wide YAML linting/formatting support via new GitHub Actions workflows, plus the associated formatter/linter configuration, and hooks YAML into the existing “detect relevant changes” mechanism.
Changes:
- Add a
.yamllintconfiguration and a Prettier YAML config (.prettierrc.yaml) for consistent formatting/linting. - Introduce
yaml-check(PR/dispatch) andyaml-fix(comment/dispatch) workflows to lint and auto-format YAML. - Extend
detect-relevant-changescomposite action to recognize YAML file types (*.yaml,*.yml).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.yamllint |
Defines yamllint rules used by the new YAML check workflow. |
.prettierrc.yaml |
Defines Prettier formatting settings used by the new YAML fix workflow. |
.github/workflows/yaml-fix.yaml |
Adds a comment/dispatch-triggered workflow to auto-format YAML via Prettier and commit fixes back to PRs. |
.github/workflows/yaml-check.yaml |
Adds a PR/dispatch-triggered workflow to run yamllint (optionally skipped when no YAML changes are detected). |
.github/actions/detect-relevant-changes/action.yaml |
Adds YAML patterns and disables .in variants for YAML relevance detection. |
| if: > | ||
| github.event_name == 'workflow_dispatch' || | ||
| ( | ||
| github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request && | ||
| contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association) && | ||
| ( | ||
| startsWith(github.event.comment.body, format('@{0}bot format', github.event.repository.name)) || | ||
| startsWith(github.event.comment.body, format('@{0}bot yaml-fix', github.event.repository.name)) | ||
| ) | ||
| ) | ||
| outputs: | ||
| ref: ${{ (github.event_name == 'workflow_dispatch' && (github.event.inputs.ref || github.ref)) || steps.get_pr.outputs.ref }} | ||
| repo: ${{ steps.get_pr.outputs.repo || github.repository }} | ||
|
|
There was a problem hiding this comment.
This workflow allows triggering via issue_comment with an author_association check, but it’s missing the standard inline documentation block explaining the security rationale (the same one used in other *-fix workflows referencing .github/AUTHORIZATION_ANALYSIS.md). Add that comment near the if: guard so future edits don’t accidentally weaken the authorization logic.
knoepfel
left a comment
There was a problem hiding this comment.
Looks reasonable to me, @greenc-FNAL. Please check the copilot comment and see if it is relevant.
- Per #364 (comment) - Also remove references to removed .github/AUTHORIZATION_ANALYSIS.md
No description provided.