From 9e9a5b49d01ef86d377272382e74a8df37df5c42 Mon Sep 17 00:00:00 2001 From: Ioannis Karasavvaidis <32846251+CoMfUcIoS@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:31:10 +0100 Subject: [PATCH] (MAINT) Fix for dependabot.yml and exclude it from yamlfix (#492) * Update dependabot.yml * fix(workflows): update yamlformatter paths to include all directories - Changed the paths in yamlformatter.yml to '**/*.yml' and '**/*.yaml' to ensure all YAML files in any directory are formatted. * fix(workflows): update yamlfix-action version to v1.0.8 - Changed the version of comfucios/yamlfix-action from 1.0.8 to v1.0.8 in yamlformatter.yml. * Apply Yamlfix format changes. * fix(workflows): remove dependabot.yml from changed_files.txt - Added a sed command to remove dependabot.yml from changed_files.txt in yamlformatter.yml. * fix(workflows): ensure removal of dependabot.yml from changed_files.txt without failure - Added a sed command to remove dependabot.yml from changed_files.txt in yamlformatter.yml. - Ensured the command does not fail if dependabot.yml does not exist in the list. * Apply Yamlfix format changes. * fix(workflows): ensure removal of .github/dependabot.yml from changed_files.txt without failure - Updated sed command to remove .github/dependabot.yml from changed_files.txt in yamlformatter.yml. - Ensured the command does not fail if .github/dependabot.yml does not exist in the list. * Apply Yamlfix format changes. * fix(workflow): correct sed command for removing dependabot.yml The sed command was updated to remove the unnecessary empty string argument for compatibility. This change ensures that the dependabot.yml file is correctly excluded from the list of changed YAML files. --------- Co-authored-by: CoMfUcIoS --- .github/dependabot.yml | 2 +- .github/workflows/yamlformatter.yml | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 18dfb8d4..0ac5405e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,5 +6,5 @@ updates: directory: / schedule: interval: daily - time: 13:00 + time: '13:00' open-pull-requests-limit: 10 diff --git a/.github/workflows/yamlformatter.yml b/.github/workflows/yamlformatter.yml index c4c52151..4c70d349 100644 --- a/.github/workflows/yamlformatter.yml +++ b/.github/workflows/yamlformatter.yml @@ -3,7 +3,7 @@ name: Format yaml files on: pull_request: branches: [main] - paths: ['*.yml', '*.yaml'] + paths: ['**/*.yml', '**/*.yaml'] permissions: contents: write pull-requests: write @@ -22,11 +22,14 @@ jobs: id: changed_yaml_files run: | echo ${{ steps.get_file_changes.outputs.files }} | xargs -n 1 | grep -E "\.yml$|\.yaml$" > changed_files.txt + # Remove dependabot.yml if it exists in the list + sed -i '/.github\/dependabot.yml/d' changed_files.txt || true yaml_files=$(cat changed_files.txt | tr '\n' ' ') + rm changed_files.txt echo "files=${yaml_files}" >> $GITHUB_OUTPUT - name: Yamlfix id: yamlfix - uses: comfucios/yamlfix-action@1.0.8 + uses: comfucios/yamlfix-action@v1.0.8 with: files: ${{ steps.changed_yaml_files.outputs.files }} - name: commit-changes