Skip to content

fix: update fork warn workflow #92

fix: update fork warn workflow

fix: update fork warn workflow #92

Workflow file for this run

name: Validate config files
on:
pull_request:
branches:
- main
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
team-matrix: ${{ steps.generate-matrix.outputs.teams-matrix }}
steps:
- uses: actions/checkout@v6
- id: generate-matrix
shell: bash
run: |
# Initialize the list
list="["
# Loop over all .yaml files in ./teams
first=true
for file in ./teams/*.yaml; do
# Extract filename without path and .yaml extension
filename=$(basename "$file" .yaml)
# Add comma separator for all but the first item
if [ "$first" = true ]; then
list="${list}{\"team\": \"$filename\"}"
first=false
else
list="${list}, {\"team\": \"$filename\"}"
fi
done
# Close the list
list="${list}]"
# Output the result
echo "teams-matrix=${list}" >> "$GITHUB_OUTPUT"
validate-yaml:
runs-on: ubuntu-latest
needs: generate-matrix
strategy:
fail-fast: false
matrix:
include: "${{ fromJSON(needs.generate-matrix.outputs.team-matrix) }}"
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.14'
- name: Install script dependencies
run: |
python -m pip install -U pip
python -m pip install jsonschema ruamel.yaml typer
- name: Run script to validate teams.yaml against schema
run: |
python scripts/validate-yaml.py teams/${{ matrix.team }}.yaml teams.schema.yaml
check-valid-yaml:
runs-on: ubuntu-latest
needs: validate-yaml
if: always()
steps:
- name: All yaml checks ok
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some yaml checks failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
tofu-lint-fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Setup tflint
uses: terraform-linters/setup-tflint@v6
- name: Run tofu fmt
uses: dflook/tofu-fmt@v2
with:
path: tf-config
- name: Run tflint
run: tflint --fix
working-directory: tf-config
# FIXME
# - name: Add and Commit any changes made
# uses: EndBug/add-and-commit@v9
# with:
# default_author: github_actions
# message: "Run tofu fmt and lint"
# push: "origin HEAD:${{ github.head_ref }}"