From ed6b8ea07541e6ffc4d514c63d6013fedfeca3af Mon Sep 17 00:00:00 2001 From: sangeet-joy_xero Date: Thu, 19 Sep 2024 10:51:01 +0530 Subject: [PATCH] yaml linting code --- .github/workflows/pr.yml | 34 +++++++++++++++++++++++++++++++--- xero_files.yaml | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 85886f59e..623ce38ba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,11 +10,39 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout codegen repo + - name: Checkout Repository uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 with: - repository: xero-internal/xeroapi-sdk-codegen - path: xeroapi-sdk-codegen + python-version: '3.x' + + - name: Install yaml lint + run: pip install yamllint + + - name: Get list of changed files + id: changed_files + run: | + git fetch origin ${{github.base_ref}} --depth=1 + git diff --name-only origin/${{github.base_ref}}...HEAD > changed_files.txt + grep -E '\.ya?ml$' changed_files.txt > yaml_files.txt || true + + - name: Run yaml lint on changed files + run: | + if [ -s yaml_files.txt ]; then + echo "Linting the following yaml files:" + cat yaml_files.txt + xargs yamllint < yaml_files.txt + else + echo 'no yaml files changed' + fi + + # - name: Checkout codegen repo + # uses: actions/checkout@v4 + # with: + # repository: xero-internal/xeroapi-sdk-codegen + # path: xeroapi-sdk-codegen # - name: Install octokit dependencies # run: npm i diff --git a/xero_files.yaml b/xero_files.yaml index a2a5ae796..53346e9a7 100644 --- a/xero_files.yaml +++ b/xero_files.yaml @@ -32,7 +32,7 @@ paths: schema: type: integer maximum: 100 - example: 50 + example: 50000 - in: query name: page description: number of records to skip for pagination