4-adding-workflows #9
This file contains 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: ai-cfia workflows | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- closed | ||
- synchronize | ||
jobs: | ||
python-lint: | ||
name: workflow-lint-test-python | ||
uses: ai-cfia/github-workflows/.github/workflows/workflow-lint-test-python.yml@main | ||
secrets: inherit | ||
mkd-check: | ||
name: workflow-markdown-check | ||
uses: ai-cfia/github-workflows/.github/workflows/workflow-markdown-check.yml@main | ||
with: # to pass inputs to called workflow | ||
config-file-path: '.mlc_config.json' | ||
secrets: inherit | ||
repo-validation: | ||
name: workflow-repo-standards-validation | ||
uses: ai-cfia/github-workflows/.github/workflows/workflow-repo-standards-validation.yml@main | ||
secrets: inherit | ||
# This job wat modified to use the default yamllint configuration | ||
# We needed to change the config of the main | ||
# yaml-check: | ||
# name: workflow-yaml-check | ||
# #runs-on: ubuntu-latest | ||
# # steps: | ||
# # - name: yaml-lint | ||
# # run: ai-cfia/github-workflows/.github/workflows/workflow-yaml-check.yml@main | ||
# # - name: extension-lint | ||
# # run: github-workflows/.yamllint.yml@main | ||
# uses: ai-cfia/github-workflows/.github/workflows/workflow-yaml-check.yml@main | ||
# # I need to add the extends part to change the max line length | ||
# with: | ||
# config-file-path: 'github-workflows/.yamllint.yml' | ||
# secrets: inherit | ||
yaml-check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Get changed files | ||
id: files | ||
uses: lots0logs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Install yamllint | ||
run: pip install yamllint | ||
- name: Lint YAML files | ||
run: | | ||
files=$(echo '${{ steps.files.outputs.all }}' | jq -r '.[]') | ||
for file in $files; do | ||
if [[ $file == *.yml || $file == *.yaml ]]; then | ||
# Check if a custom config path is provided and file exists | ||
if [ -n "${{ github.event.inputs.config-file-path }}" ]; then | ||
yamllint -c "${{ github.workspace }}/${{ github.event.inputs.config-file-path }}" "$file" | ||
else | ||
yamllint "$file" | ||
fi | ||
fi | ||
done | ||
shell: bash | ||
extends: default | ||
Check failure on line 71 in .github/workflows/workflows.yml GitHub Actions / ai-cfia workflowsInvalid workflow file
Check failure on line 71 in .github/workflows/workflows.yml GitHub Actions / ai-cfia workflowsInvalid workflow file
|
||
rules: | ||
# 80 chars should be enough, but don't fail if a line is longer | ||
line-length: | ||
max: 100 | ||
level: Error |