From 2bbc0f5da6e30bad567b673d7c5907e2538620c0 Mon Sep 17 00:00:00 2001 From: Jason Q <81179619+beqqrry-aws@users.noreply.github.com> Date: Thu, 22 Feb 2024 11:09:57 -0700 Subject: [PATCH] GitHub: Updates and splits the super-linter and yaml linter. (#6159) --- .github/workflows/super-linter.yml | 45 +++++++----------------------- .github/workflows/yaml-lint.yml | 36 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/yaml-lint.yml diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 8fe3fd3ce9d..9676b7cd5d3 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -1,18 +1,9 @@ -# This workflow executes several linters on changed files based on languages used in your code base whenever -# you push a code or open a pull request. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/github/super-linter +# This workflow uses https://github.com/github/super-linter + name: Lint Code Base on: - push: - branches: [main] pull_request: - branches: [main] - - # Lets you to run this workflow manually from the Actions tab workflow_dispatch: jobs: @@ -20,12 +11,15 @@ jobs: name: Lint Multiple runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: Checkout files + uses: actions/checkout@v4 with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - + sparse-checkout: | + .github + php + python + ruby + kotlin - name: Lint Code Base uses: github/super-linter@v4 env: @@ -37,22 +31,3 @@ jobs: VALIDATE_PYTHON_BLACK: true VALIDATE_RUBY: true VALIDATE_KOTLIN: true - yamllint: - name: Lint Yaml - # The type of runner that the job will run on - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: checkout repo content - uses: actions/checkout@v3 # checkout the repository content to github runner. - - name: setup python - uses: actions/setup-python@v3 - with: - python-version: 3.11 #install the python needed - - name: Install dependencies - run: >- - python3 -m pip install -r .tools/base_requirements.txt - - name: Lint metadata files - run: >- - yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata diff --git a/.github/workflows/yaml-lint.yml b/.github/workflows/yaml-lint.yml new file mode 100644 index 00000000000..e899e19005d --- /dev/null +++ b/.github/workflows/yaml-lint.yml @@ -0,0 +1,36 @@ +name: Lint Metadata Yaml + +on: + pull_request: + workflow_dispatch: + +jobs: + yamllint: + name: Lint Yaml + runs-on: ubuntu-latest + steps: + - name: Checkout files + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github + .doc_gen/metadata + .tools + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v41 + with: + files: ".doc_gen/metadata/**/*.{yml,yaml}" + - name: Setup Python + if: steps.changed-files.outputs.any_changed == 'true' + uses: actions/setup-python@v3 + with: + python-version: 3.11 + - name: Install dependencies + if: steps.changed-files.outputs.any_changed == 'true' + run: >- + python3 -m pip install -r .tools/base_requirements.txt + - name: Lint metadata files + if: steps.changed-files.outputs.any_changed == 'true' + run: >- + yamllint --format standard -c .tools/validation/.yamllint.yaml .doc_gen/metadata