You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
--- |
|
name: Workflow Linter |
|
|
|
on: |
|
pull_request: |
|
paths: |
|
- .github/workflows/** |
|
workflow_call: |
|
|
|
jobs: |
|
lint: |
|
name: "Workflow Linter" |
|
runs-on: ubuntu-20.04 |
|
steps: |
|
- name: Checkout Branch |
|
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- 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="" |
|
for workflow in $MODIFIED_WORKFLOWS; do |
|
if [ -f $workflow ]; then |
|
MODIFIED_EXISTING_WORKFLOWS+=" ${workflow}" |
|
fi |
|
done |
|
echo "modified-workflows=$MODIFIED_EXISTING_WORKFLOWS" >> $GITHUB_OUTPUT |
|
|
|
- name: Workflow Lint |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
uses: bitwarden/gh-actions/lint-workflow@72594be690a4e7bfa87b1402b2aedc75acdbff12 |
|
with: |
|
workflows: ${{ steps.changed-workflows.outputs.modified-workflows }} |
|
|
|
- name: Get changed files |
|
id: changed-files |
|
uses: tj-actions/changed-files@bb3376162b179308a79fc4450262a15a8e1d6888 # v37.0.4 |
|
with: |
|
files: .github/workflows/** |
|
|
|
- name: Check for pinned versions |
|
if: steps.changed-files.outputs.any_changed == 'true' |
|
shell: bash |
|
env: |
|
FILE: ${{ steps.changed-files.outputs.all_changed_files }} |
|
run: | |
|
FILES=$(echo "${{ env.FILE }}") |
|
curl -o $PWD/version-lint.sh https://raw.githubusercontent.com/bitwarden/gh-actions/master/.github/version-lint.sh |
|
chmod +x $PWD/version-lint.sh && $PWD/version-lint.sh $FILES
|
|
|