Skip to content

[deps]: Update nuget minor #239

[deps]: Update nuget minor

[deps]: Update nuget minor #239

name: Lint workflow
on:
pull_request:
paths:
- .github/workflows/**
merge_group:
types: [checks_requested]
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-24.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: Check changed files for workflow changes
id: changed-workflows
run: |
if ${{ github.event_name == 'pull_request' }}; then
changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)
else
changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)
fi
count=$(( 0 ))
files_to_lint=""
for file in $changed_files; do
if [[ "$file" == ".github/workflows/"* ]]; then
count=$(( $count + 1 ))
files_to_lint="$files_to_lint $file"
fi
done
echo "Workflow files changed: $count"
echo "Files to lint: $files_to_lint"
echo "changed_files=$files_to_lint" >> $GITHUB_OUTPUT
echo "changed_files_count=$count" >> $GITHUB_OUTPUT
- name: Download actionlint configuration
if: steps.changed-workflows.outputs.changed_files_count != '0'
run: |
curl \
--fail \
--create-dirs \
--output .github/actionlint.yml \
https://raw.githubusercontent.com/bitwarden/workflow-linter/refs/heads/main/.github/actionlint.yml
- name: Set up Python 3.12
if: steps.changed-workflows.outputs.changed_files_count != '0'
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
with:
python-version: "3.12.10"
- name: Install bwwl binary
if: steps.changed-workflows.outputs.changed_files_count != '0'
run: python -m pip install --upgrade bitwarden_workflow_linter
- name: Lint
env:
files: ${{ steps.changed-workflows.outputs.changed_files }}
if: steps.changed-workflows.outputs.changed_files_count != '0'
run: |
echo $files
bwwl lint -f $files