Feature automate change-log #711
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
# .github/workflows/yaml-lint.yml | |
--- | |
name: YAML Lint | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: ["main", "master", "stable"] | |
pull_request: | |
branches: ["main", "master", "stable", "feature-*", "patch-*", "HOTFIX-*"] | |
permissions: {} # Setting default permissions to none for enhanced security | |
jobs: | |
yaml-lint: | |
permissions: | |
contents: read | |
statuses: write | |
runs-on: ubuntu-latest | |
env: | |
YAML_ARGS: ${{ vars.YAML_ARGS }} | |
GIT_MATCH_PATTERN: "*.yaml *.yml **/*.yml ./.circleci/*.yml ./.github/**/*.yml" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Lint Workflow YAML | |
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 | |
with: | |
file_or_dir: .github/workflows/yaml-lint.yml | |
config_file: .yamllint.conf | |
format: github | |
no_warnings: true | |
if: ${{ !cancelled() }} | |
- name: Get YAML Files | |
id: yamlfiles | |
shell: bash | |
run: | | |
FILES=$(git ls-files --exclude-standard -- ${{ env.GIT_MATCH_PATTERN }} ) | |
if [ -z "$FILES" ]; then | |
printf "%s\n" "No YAML files found." | |
printf "%s\n" "files=" >> "$GITHUB_OUTPUT" | |
else | |
printf "%s\n" "YAML files found:" | |
printf "%s\n" "$FILES" | |
# Replace line breaks with spaces for GitHub Action Output | |
FILES="${FILES//$'\n'/ }" | |
printf "%s\n" "files=$FILES" >> "$GITHUB_OUTPUT" | |
fi | |
if: ${{ success() }} | |
- name: Lint YAML Files | |
uses: ibiqlik/action-yamllint@2576378a8e339169678f9939646ee3ee325e845c # v3.1.1 | |
with: | |
file_or_dir: ${{ steps.yamlfiles.outputs.files }} | |
config_file: .yamllint.conf | |
format: github | |
no_warnings: true | |
if: ${{ !cancelled() && steps.yamlfiles.outputs.files != '' }} |