Skip to content

Lint workflow

Lint workflow #460

Workflow file for this run

name: Lint workflow
on:
pull_request:
paths:
- .github/workflows/**
merge_group:
types: [checks_requested]
workflow_call:
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Check out branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ github.repository }}
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
# - name: Get changed files
# id: changed-workflows
# uses: tj-actions/changed-files@dcc7a0cba800f454d79fff4b993e8c3555bcc0a8 # v45.0.7
# with:
# files: .github/workflows/**
- name: Stub step
id: changed-workflows
run: echo "all_changed_files_count=0" >> $GITHUB_OUTPUT
- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- name: List changed files
run: |
for file in ${{ steps.changed-files.outputs.changed_files }}; do
echo "$file was changed"
done
- name: Set up Python 3.11
if: steps.changed-workflows.outputs.all_changed_files_count != '0'
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.11"
- name: Install bwwl binary
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.all_changed_files_count != '0'
run: bwwl lint -f .github/workflows