diff --git a/.github/workflows/workflow-linter.yml b/.github/workflows/workflow-linter.yml index 5f6fc864..7de8f6f7 100644 --- a/.github/workflows/workflow-linter.yml +++ b/.github/workflows/workflow-linter.yml @@ -28,20 +28,11 @@ jobs: repository: ${{ steps.repo.outputs.repo }} fetch-depth: 0 - - name: Get changed workflows + - name: Get changed files id: changed-workflows - run: | - MODIFIED_WORKFLOWS=$(git diff --name-only origin/${{ github.base_ref }} | grep -E '.github/workflows/.*.(yml|yaml)' | tr '\n' ' ') - MODIFIED_EXISTING_WORKFLOWS="" - COUNT=0 - for workflow in $MODIFIED_WORKFLOWS; do - if [ -f $workflow ]; then - MODIFIED_EXISTING_WORKFLOWS+=" ${workflow}" - COUNT=$((COUNT+1)) - fi - done - echo "count=$COUNT" >> $GITHUB_OUTPUT - echo "modified-workflows=$MODIFIED_EXISTING_WORKFLOWS" >> $GITHUB_OUTPUT + uses: tj-actions/changed-files@c3a1bb2c992d77180ae65be6ae6c166cf40f857c # v45.0.3 + with: + files: .github/workflows/** - name: Set up Python 3.11 uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b @@ -49,9 +40,9 @@ jobs: python-version: "3.11" - name: Install bwwl binary - if: steps.changed-workflows.outputs.count != 0 + if: steps.changed-workflows.outputs.all_changed_files_count != 0 run: python -m pip install --upgrade bitwarden_workflow_linter - name: Lint - if: steps.changed-workflows.outputs.count != 0 + if: steps.changed-workflows.outputs.all_changed_files_count != 0 run: bwwl lint -f .github/workflows