From cf8d99984cd2ae6612f6f34781c27b94d7b8f3b4 Mon Sep 17 00:00:00 2001 From: SonOfLope Date: Fri, 1 Mar 2024 16:42:49 -0500 Subject: [PATCH] Issue #101: Adding unified yaml linting rule to the yaml lint reusable workflow --- .github/workflows/workflow-yaml-check.md | 24 ++++++++++++++++------- .github/workflows/workflow-yaml-check.yml | 4 +++- .yamllint.yml | 8 +++++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/workflow-yaml-check.md b/.github/workflows/workflow-yaml-check.md index 5cded6f4..8c496ae8 100644 --- a/.github/workflows/workflow-yaml-check.md +++ b/.github/workflows/workflow-yaml-check.md @@ -2,20 +2,30 @@ ## Overview -This workflow is designed to maintain and enforce coding standards within YAML files across multiple projects within the organization. It ensures that any changes made to YAML files are consistent with the predefined standards set by the organization. +This workflow is designed to maintain and enforce coding standards within YAML +files across multiple projects within the organization. It ensures that any +changes made to YAML files are consistent with the predefined standards set by +the organization. ## Usage -- **Purpose:** Validate the organization's yaml standards across projects. It is triggered by **pull requests** to ensure that any new or altered YAML files comply with these standards. +- **Purpose:** Validate the organization's yaml standards across projects. It is + triggered by **pull requests** to ensure that any new or altered YAML files + comply with these standards. - **Steps** - - YAML Lint Test: The workflow runs a linting test on the changed YAML files using the given configuration if specified. + - YAML Lint Test: The workflow runs a linting test on the changed YAML files + using the given configuration if specified. - **Input:** You can specify specify a custom configuration file path for the yaml link check. If you have specific rules or configurations for link - validation, you can create a configuration file in the project you are - calling this workflow from and input the path to this workflow. You can - find the documentation for this file + validation, you can create a configuration file in the project you are calling + this workflow from and input the path to this workflow. If you omit to specify + a file path, the default config file from current repository will be used. You + can find the documentation for this file [here](https://yamllint.readthedocs.io/en/stable/configuration.html) ## YAML Linting Guidelines for Developers -- The [fnando.linter](https://marketplace.visualstudio.com/items?itemName=fnando.linter) extension for Visual Studio Code provides a flexible linter framework, which can be used for linting YAML files. +- The + [fnando.linter](https://marketplace.visualstudio.com/items?itemName=fnando.linter) + extension for Visual Studio Code provides a flexible linter framework, which + can be used for linting YAML files. diff --git a/.github/workflows/workflow-yaml-check.yml b/.github/workflows/workflow-yaml-check.yml index d071b9b2..40a38ed2 100644 --- a/.github/workflows/workflow-yaml-check.yml +++ b/.github/workflows/workflow-yaml-check.yml @@ -34,7 +34,9 @@ jobs: if [ -n "${{ github.event.inputs.config-file-path }}" ]; then yamllint -c "${{ github.workspace }}/${{ github.event.inputs.config-file-path }}" "$file" else - yamllint "$file" + default_config_url="https://raw.githubusercontent.com/ai-cfia/github-workflows/main/.yamllint.yml" + curl -s -O $default_config_url + yamllint -c "./$(basename $default_config_url)" "$file" fi fi done diff --git a/.yamllint.yml b/.yamllint.yml index ceae6326..ad3e5e57 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,7 +1,9 @@ --- extends: default +ignore: | + .git/ + rules: - line-length: - max: 120 - allow-non-breakable-inline-mappings: true + line-length: disable + truthy: disable