From 3870c00480c8e1e529e0a7a0e83d88df981f58ee Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:12:11 -0500 Subject: [PATCH] Revert "[DEVOPS-1597] - Use Action to Get Changed Files" --- .github/workflows/workflow-linter.yml | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow-linter.yml b/.github/workflows/workflow-linter.yml index bb613eb1..aa445d18 100644 --- a/.github/workflows/workflow-linter.yml +++ b/.github/workflows/workflow-linter.yml @@ -19,19 +19,35 @@ jobs: repository: bitwarden/gh-actions fetch-depth: 0 - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@716b1e13042866565e00e85fd4ec490e186c4a2f # v41.0.1 - with: - files: .github/workflows/** + - name: Get changed workflows + 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 - name: Workflow Lint - if: steps.changed-files.outputs.any_changed == 'true' + if: steps.changed-workflows.outputs.count != 0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} uses: bitwarden/gh-actions/lint-workflow@main with: - workflows: ${{ steps.changed-files.outputs.all_changed_files }} + workflows: ${{ steps.changed-workflows.outputs.modified-workflows }} + + - name: Get changed files + if: steps.changed-workflows.outputs.count != 0 + id: changed-files + uses: tj-actions/changed-files@716b1e13042866565e00e85fd4ec490e186c4a2f # v41.0.1 + with: + files: .github/workflows/** - name: Check for pinned versions if: steps.changed-files.outputs.any_changed == 'true'