[OPIK-3662] Add actionlint for GitHub Actions workflow validation #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ':octocat: Lint Workflows' | |
| on: | |
| pull_request: | |
| paths: | |
| - '.github/workflows/**' | |
| jobs: | |
| actionlint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for git diff | |
| - name: Get changed workflow files | |
| id: changed-files | |
| run: | | |
| # Get list of changed workflow files | |
| CHANGED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }}...HEAD -- '.github/workflows/*.yml' '.github/workflows/*.yaml' | tr '\n' ' ') | |
| echo "files=$CHANGED_FILES" >> $GITHUB_OUTPUT | |
| echo "Changed workflow files: $CHANGED_FILES" | |
| - name: Run actionlint on changed files | |
| if: steps.changed-files.outputs.files != '' | |
| uses: raven-actions/actionlint@v2 | |
| with: | |
| version: latest | |
| files: ${{ steps.changed-files.outputs.files }} | |