Skip to content

Add check/fix workflows for YAML files#364

Merged
greenc-FNAL merged 10 commits intomainfrom
maintenance/yaml-lint-prettier
Mar 3, 2026
Merged

Add check/fix workflows for YAML files#364
greenc-FNAL merged 10 commits intomainfrom
maintenance/yaml-lint-prettier

Conversation

@greenc-FNAL
Copy link
Contributor

No description provided.

@knoepfel
Copy link
Member

@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.

@greenc-FNAL
Copy link
Contributor Author

greenc-FNAL commented Feb 25, 2026

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

@greenc-FNAL
Copy link
Contributor Author

@phlexbot yaml-fix

Copilot AI review requested due to automatic review settings March 3, 2026 18:06
@greenc-FNAL greenc-FNAL force-pushed the maintenance/yaml-lint-prettier branch from 3de01e7 to eee154c Compare March 3, 2026 18:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .yamllint configuration and a Prettier YAML config (.prettierrc.yaml) for consistent formatting/linting.
  • Introduce yaml-check (PR/dispatch) and yaml-fix (comment/dispatch) workflows to lint and auto-format YAML.
  • Extend detect-relevant-changes composite 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.

Comment on lines +23 to +37
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 }}

Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Member

@knoepfel knoepfel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me, @greenc-FNAL. Please check the copilot comment and see if it is relevant.

@greenc-FNAL greenc-FNAL requested a review from knoepfel March 3, 2026 21:07
@greenc-FNAL greenc-FNAL merged commit 2f9bec6 into main Mar 3, 2026
59 checks passed
@greenc-FNAL greenc-FNAL deleted the maintenance/yaml-lint-prettier branch March 3, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants