From 2782d3a8f2cc546e647054c37d3469f04a7d14e6 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:14:58 +0200 Subject: [PATCH 01/15] Ensure scripts fail if finding the latest tagged commit fails --- .github/lint-changed-python-files.sh | 5 +++++ .github/lint-changed-yaml-tests.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/.github/lint-changed-python-files.sh b/.github/lint-changed-python-files.sh index b745677..afaffbf 100755 --- a/.github/lint-changed-python-files.sh +++ b/.github/lint-changed-python-files.sh @@ -2,6 +2,11 @@ last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +if [ $? -ne 0 ]; then + echo "Error: Failed to find the last tagged commit." + exit 1 +fi + if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "*.py") then echo "Linting the following Python files:" diff --git a/.github/lint-changed-yaml-tests.sh b/.github/lint-changed-yaml-tests.sh index 9e2ab56..2f3c5d6 100755 --- a/.github/lint-changed-yaml-tests.sh +++ b/.github/lint-changed-yaml-tests.sh @@ -2,6 +2,11 @@ last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +if [ $? -ne 0 ]; then + echo "Error: Failed to find the last tagged commit." + exit 1 +fi + if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "tests/*.yaml") then echo "Linting the following changed YAML tests:" From 667a70fe962fd3074106166e5eaa450dfd3feabb Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:18:10 +0200 Subject: [PATCH 02/15] Always return a result even with no reachable tags --- .github/lint-changed-python-files.sh | 2 +- .github/lint-changed-yaml-tests.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/lint-changed-python-files.sh b/.github/lint-changed-python-files.sh index afaffbf..c061543 100755 --- a/.github/lint-changed-python-files.sh +++ b/.github/lint-changed-python-files.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit if [ $? -ne 0 ]; then echo "Error: Failed to find the last tagged commit." diff --git a/.github/lint-changed-yaml-tests.sh b/.github/lint-changed-yaml-tests.sh index 2f3c5d6..9b080f2 100755 --- a/.github/lint-changed-yaml-tests.sh +++ b/.github/lint-changed-yaml-tests.sh @@ -1,6 +1,6 @@ #! /usr/bin/env bash -last_tagged_commit=`git describe --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit if [ $? -ne 0 ]; then echo "Error: Failed to find the last tagged commit." From 7afe3008235bfcbf04d30fdc9c5567eb664059a7 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:23:06 +0200 Subject: [PATCH 03/15] Skip deploy job if Pypi token is not defined Use intermediary job as secrets cannot be directly referenced in `if:` conditionals; see https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow --- .github/workflows/deploy.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 34dd027..6ab4b1e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -25,10 +25,24 @@ jobs: - id: stop-early run: if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then echo "::set-output name=status::success" ; fi + check-pypi-token: + runs-on: ubuntu-22.04 + outputs: + pypi_token_present: ${{ steps.check_token.outputs.pypi_token_present }} + steps: + - name: Check PYPI Token + id: check_token + run: | + if [[ -n "${{ secrets.PYPI_TOKEN_OPENFISCA_BOT }}" ]]; then + echo "pypi_token_present=true" >> $GITHUB_OUTPUT + else + echo "pypi_token_present=false" >> $GITHUB_OUTPUT + fi + deploy: runs-on: ubuntu-22.04 - needs: [ validate, check-for-functional-changes ] - if: needs.check-for-functional-changes.outputs.status == 'success' + needs: [ validate, check-for-functional-changes, check-pypi-token ] + if: needs.check-for-functional-changes.outputs.status == 'success' && needs.check-pypi-token.outputs.pypi_token_present == 'true' steps: - uses: actions/checkout@v4 - name: Set up Python From 661329a7a2763509adddb75572a3f8507ffb3956 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:23:15 +0200 Subject: [PATCH 04/15] Update deprecated syntax --- .github/workflows/deploy.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6ab4b1e..cbf4378 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -23,7 +23,10 @@ jobs: with: python-version: 3.9.12 - id: stop-early - run: if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then echo "::set-output name=status::success" ; fi + run: | + if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then + echo "status=success" >> $GITHUB_OUTPUT + fi check-pypi-token: runs-on: ubuntu-22.04 From 695050aa95990d4262e16ec475f252f1a44b63b1 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:24:56 +0200 Subject: [PATCH 05/15] Rename PyPI token GitHub secret --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index cbf4378..1d586d0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -36,7 +36,7 @@ jobs: - name: Check PYPI Token id: check_token run: | - if [[ -n "${{ secrets.PYPI_TOKEN_OPENFISCA_BOT }}" ]]; then + if [[ -n "${{ secrets.PYPI_TOKEN }}" ]]; then echo "pypi_token_present=true" >> $GITHUB_OUTPUT else echo "pypi_token_present=false" >> $GITHUB_OUTPUT @@ -63,6 +63,6 @@ jobs: path: dist key: release-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} - name: Upload a Python package to PyPi - run: twine upload dist/* --username __token__ --password ${{ secrets.PYPI_TOKEN_OPENFISCA_BOT }} + run: twine upload dist/* --username __token__ --password ${{ secrets.PYPI_TOKEN }} - name: Publish a git tag run: "${GITHUB_WORKSPACE}/.github/publish-git-tag.sh" From 9eb3c6896b0855c73ac3f259993d5cdababfb80f Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:44:53 +0200 Subject: [PATCH 06/15] Update packaging section in README --- README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fbbe62..000e7c9 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,35 @@ The files that are outside from the `openfisca_country_template` folder are used ## Packaging your Country Package for Distribution -Country packages are python distributions. To distribute your package via `pip`, follow the steps given by the [Python Packaging Authority](https://python-packaging-user-guide.readthedocs.io/tutorials/distributing-packages/#packaging-your-project). +Country packages are Python distributions. You can choose to distribute your package automatically via our continuous deployment system on GitHub, or manually. + +### Automatic continuous deployment on GitHub + +This repository is configured with a continuous deployment system to automate the distribution of your package via `pip`. + +#### Setting up continuous deployment + +To activate the continuous deployment: + +1. Create an account on [PyPI](https://pypi.org/) if you don't already have one. +2. Generate a token in your PyPI account. This token will allow GitHub Actions to securely upload new versions of your package to PyPI. +3. Add this token to your GitHub repository's secrets under the name `PYPI_TOKEN`. + +Once set up, changes to the `main` branch will trigger an automated workflow to build and publish your package to PyPI, making it available for `pip` installation. + +### Manual distribution + +If you prefer to manually manage the release and distribution of your package, follow the guidelines provided by the [Python Packaging Authority](https://python-packaging-user-guide.readthedocs.io/tutorials/distributing-packages/#packaging-your-project). + +This involves detailed steps on preparing your package, creating distribution files, and uploading them to PyPI. + +### Accessing your package + +Once deployed, your package can be easily installed by users with the following command: + +```sh +pip install openfisca- +``` ## Install Instructions for Users and Contributors From 2bf47771f2233f04259a45798859b47913df4dcb Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 17:59:50 +0200 Subject: [PATCH 07/15] Add changelog entry --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 251fe11..1f0a2ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +### 7.1.2 [#147](https://github.com/openfisca/country-template/pull/147) + +* Technical improvement +* Details: + - Skip `deploy` workflow when PyPI token is not defined in GitHub secrets + - Ensure lint scripts work properly without reachable tags + - Rename the GitHub secret `PYPI_TOKEN_OPENFISCA_BOT` used in `deploy` workflow to `PYPI_TOKEN` + - Update deprecated syntax in GitHub Action workflow + ### 7.1.1 [#146](https://github.com/openfisca/country-template/pull/146) * Technical improvement From 42d4e9d34e59b481c25d1f776a73b710b9068e6b Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Thu, 9 May 2024 18:01:12 +0200 Subject: [PATCH 08/15] Update version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 73e06bc..02d51f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "openfisca-country_template" -version = "7.1.1" +version = "7.1.2" description = "OpenFisca Rules as Code model for Country-Template." readme = "README.md" keywords = ["microsimulation", "tax", "benefit", "rac", "rules-as-code"] From e751b8b96806b99dd1b98555c2fc45892f317146 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:18:53 +0200 Subject: [PATCH 09/15] Improve wording Co-authored-by: Matti Schneider --- .github/workflows/deploy.yml | 2 +- CHANGELOG.md | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1d586d0..4c469a9 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,7 +33,7 @@ jobs: outputs: pypi_token_present: ${{ steps.check_token.outputs.pypi_token_present }} steps: - - name: Check PYPI Token + - name: Check PyPI token is defined id: check_token run: | if [[ -n "${{ secrets.PYPI_TOKEN }}" ]]; then diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f0a2ea..29db732 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ - Skip `deploy` workflow when PyPI token is not defined in GitHub secrets - Ensure lint scripts work properly without reachable tags - Rename the GitHub secret `PYPI_TOKEN_OPENFISCA_BOT` used in `deploy` workflow to `PYPI_TOKEN` - - Update deprecated syntax in GitHub Action workflow + - Update deprecated syntax in GitHub Actions workflow ### 7.1.1 [#146](https://github.com/openfisca/country-template/pull/146) diff --git a/README.md b/README.md index 000e7c9..a0edb52 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ The files that are outside from the `openfisca_country_template` folder are used ## Packaging your Country Package for Distribution -Country packages are Python distributions. You can choose to distribute your package automatically via our continuous deployment system on GitHub, or manually. +Country packages are Python distributions. You can choose to distribute your package automatically via the predefined continuous deployment system on GitHub Actions, or manually. ### Automatic continuous deployment on GitHub From ff314a53587f56c6067534046a9b9fa9e877ec29 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:19:18 +0200 Subject: [PATCH 10/15] Remove redundant instructions Co-authored-by: Matti Schneider --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index a0edb52..bbc8983 100644 --- a/README.md +++ b/README.md @@ -78,13 +78,6 @@ If you prefer to manually manage the release and distribution of your package, f This involves detailed steps on preparing your package, creating distribution files, and uploading them to PyPI. -### Accessing your package - -Once deployed, your package can be easily installed by users with the following command: - -```sh -pip install openfisca- -``` ## Install Instructions for Users and Contributors From 69286d832392648da1c5c5cf34cc32f04d0c83fa Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:18:06 +0200 Subject: [PATCH 11/15] Unify bash multiline --- .github/lint-changed-python-files.sh | 3 ++- .github/lint-changed-yaml-tests.sh | 3 ++- .github/workflows/deploy.yml | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/lint-changed-python-files.sh b/.github/lint-changed-python-files.sh index c061543..a23bcef 100755 --- a/.github/lint-changed-python-files.sh +++ b/.github/lint-changed-python-files.sh @@ -2,7 +2,8 @@ last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit -if [ $? -ne 0 ]; then +if [ $? -ne 0 ] +then echo "Error: Failed to find the last tagged commit." exit 1 fi diff --git a/.github/lint-changed-yaml-tests.sh b/.github/lint-changed-yaml-tests.sh index 9b080f2..a1a42fb 100755 --- a/.github/lint-changed-yaml-tests.sh +++ b/.github/lint-changed-yaml-tests.sh @@ -2,7 +2,8 @@ last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit -if [ $? -ne 0 ]; then +if [ $? -ne 0 ] +then echo "Error: Failed to find the last tagged commit." exit 1 fi diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4c469a9..19d7d40 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,8 @@ jobs: python-version: 3.9.12 - id: stop-early run: | - if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" ; then + if "${GITHUB_WORKSPACE}/.github/has-functional-changes.sh" + then echo "status=success" >> $GITHUB_OUTPUT fi @@ -36,7 +37,8 @@ jobs: - name: Check PyPI token is defined id: check_token run: | - if [[ -n "${{ secrets.PYPI_TOKEN }}" ]]; then + if [[ -n "${{ secrets.PYPI_TOKEN }}" ]] + then echo "pypi_token_present=true" >> $GITHUB_OUTPUT else echo "pypi_token_present=false" >> $GITHUB_OUTPUT From f90bf289e03ab12efc7fdb67fce56bee2dfed668 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:20:26 +0200 Subject: [PATCH 12/15] Add comment --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 19d7d40..76a02ae 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -29,7 +29,7 @@ jobs: echo "status=success" >> $GITHUB_OUTPUT fi - check-pypi-token: + check-pypi-token: # Use intermediary job as secrets cannot be directly referenced in `if:` conditionals; see https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#using-secrets-in-a-workflow runs-on: ubuntu-22.04 outputs: pypi_token_present: ${{ steps.check_token.outputs.pypi_token_present }} From cb310dc31825c905ed0ee0506e5a2e5a31603547 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:41:07 +0200 Subject: [PATCH 13/15] Fallback to lint all files if there are no tags --- .github/lint-changed-python-files.sh | 7 +++---- .github/lint-changed-yaml-tests.sh | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/lint-changed-python-files.sh b/.github/lint-changed-python-files.sh index a23bcef..fe0709c 100755 --- a/.github/lint-changed-python-files.sh +++ b/.github/lint-changed-python-files.sh @@ -1,11 +1,10 @@ #! /usr/bin/env bash -last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches -if [ $? -ne 0 ] +if [ -z "$last_tagged_commit" ] then - echo "Error: Failed to find the last tagged commit." - exit 1 + last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present fi if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "*.py") diff --git a/.github/lint-changed-yaml-tests.sh b/.github/lint-changed-yaml-tests.sh index a1a42fb..5d3288c 100755 --- a/.github/lint-changed-yaml-tests.sh +++ b/.github/lint-changed-yaml-tests.sh @@ -1,11 +1,10 @@ #! /usr/bin/env bash -last_tagged_commit=`git describe --always --tags --abbrev=0 --first-parent` # --first-parent ensures we don't follow tags not published in main through an unlikely intermediary merge commit +last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches -if [ $? -ne 0 ] +if [ -z "$last_tagged_commit" ] then - echo "Error: Failed to find the last tagged commit." - exit 1 + last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present fi if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "tests/*.yaml") From 269240f3dcbab63b0cc632d7705be5b0bfc01414 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 10:50:55 +0200 Subject: [PATCH 14/15] Refactor duplication by creating a generic linting script --- .github/lint-changed-python-files.sh | 16 -------------- .github/lint-changed-yaml-tests.sh | 16 -------------- .github/lint-files.sh | 32 ++++++++++++++++++++++++++++ .github/workflows/validate.yml | 6 +++--- 4 files changed, 35 insertions(+), 35 deletions(-) delete mode 100755 .github/lint-changed-python-files.sh delete mode 100755 .github/lint-changed-yaml-tests.sh create mode 100755 .github/lint-files.sh diff --git a/.github/lint-changed-python-files.sh b/.github/lint-changed-python-files.sh deleted file mode 100755 index fe0709c..0000000 --- a/.github/lint-changed-python-files.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env bash - -last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches - -if [ -z "$last_tagged_commit" ] -then - last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present -fi - -if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "*.py") -then - echo "Linting the following Python files:" - echo $changed_files - flake8 $changed_files -else echo "No changed Python files to lint" -fi diff --git a/.github/lint-changed-yaml-tests.sh b/.github/lint-changed-yaml-tests.sh deleted file mode 100755 index 5d3288c..0000000 --- a/.github/lint-changed-yaml-tests.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env bash - -last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches - -if [ -z "$last_tagged_commit" ] -then - last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present -fi - -if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "tests/*.yaml") -then - echo "Linting the following changed YAML tests:" - echo $changed_files - yamllint $changed_files -else echo "No changed YAML tests to lint" -fi diff --git a/.github/lint-files.sh b/.github/lint-files.sh new file mode 100755 index 0000000..507dff8 --- /dev/null +++ b/.github/lint-files.sh @@ -0,0 +1,32 @@ +#! /usr/bin/env bash + +# Usage: lint-files.sh +# +# Example usage: +# lint-files.sh "*.py" "flake8" +# lint-files.sh "tests/*.yaml" "yamllint" + +file_pattern=$1 +linter_command=$2 + +if [ -z "$file_pattern" ] || [ -z "$linter_command" ] +then + echo "Usage: $0 " + exit 1 +fi + +last_tagged_commit=$(git describe --tags --abbrev=0 --first-parent 2>/dev/null) # Attempt to find the last tagged commit in the direct ancestry of the main branch avoiding tags introduced by merge commits from other branches + +if [ -z "$last_tagged_commit" ] +then + last_tagged_commit=$(git rev-list --max-parents=0 HEAD) # Fallback to finding the root commit if no tags are present +fi + +if ! changed_files=$(git diff-index --name-only --diff-filter=ACMR --exit-code $last_tagged_commit -- "$file_pattern") +then + echo "Linting the following files:" + echo "$changed_files" + $linter_command $changed_files +else + echo "No changed files matching pattern '$file_pattern' to lint." +fi diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 982ee85..349f4d1 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -33,10 +33,10 @@ jobs: - run: make check-style - name: Lint Python files - run: "${GITHUB_WORKSPACE}/.github/lint-changed-python-files.sh" - + run: "${GITHUB_WORKSPACE}/.github/lint-files.sh '*.py' 'flake8'" + - name: Lint YAML tests - run: "${GITHUB_WORKSPACE}/.github/lint-changed-yaml-tests.sh" + run: "${GITHUB_WORKSPACE}/.github/lint-files.sh 'tests/*.yaml' 'yamllint'" test-yaml: runs-on: ubuntu-22.04 From 0af37a7ebb4bcb1ee30d27f09c22793448c5f343 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Fri, 10 May 2024 11:02:27 +0200 Subject: [PATCH 15/15] Remove whitespaces --- .github/workflows/validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 349f4d1..1072fbc 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -34,7 +34,7 @@ jobs: - name: Lint Python files run: "${GITHUB_WORKSPACE}/.github/lint-files.sh '*.py' 'flake8'" - + - name: Lint YAML tests run: "${GITHUB_WORKSPACE}/.github/lint-files.sh 'tests/*.yaml' 'yamllint'"