Skip to content

Commit

Permalink
use a workflow to get changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeebru committed Nov 8, 2024
1 parent b021695 commit f87879b
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/workflow-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,21 @@ 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
with:
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

0 comments on commit f87879b

Please sign in to comment.