From 5869bb694867f2ac02b04a3f0256f161e12d4171 Mon Sep 17 00:00:00 2001 From: Nicholas Felt Date: Wed, 28 Aug 2024 08:57:56 -0700 Subject: [PATCH] fix: Removed duplicate step ID from _reusable-package-testpypi.yml (#23) * fix: Removed duplicate step ID from _reusable-package-testpypi.yml. Also added a pre-commit hook to check the workflow files. * fix: Fix issues found by actionlint in workflows * ci: Skip running docker hooks in pre-commit.ci since it isn't available --- .../_reusable-check-api-for-breaking-changes.yml | 2 +- .github/workflows/_reusable-package-release.yml | 2 +- .github/workflows/_reusable-package-testpypi.yml | 8 +------- .../workflows/_reusable-publish-api-comparison.yml | 6 +++--- .pre-commit-config.yaml | 11 ++++++++++- CHANGELOG.md | 4 ++++ 6 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/_reusable-check-api-for-breaking-changes.yml b/.github/workflows/_reusable-check-api-for-breaking-changes.yml index 026a2120..5cc43631 100644 --- a/.github/workflows/_reusable-check-api-for-breaking-changes.yml +++ b/.github/workflows/_reusable-check-api-for-breaking-changes.yml @@ -30,7 +30,7 @@ jobs: run: | echo "## Breaking API Changes" > breaking_changes.md echo "\`\`\`" >> breaking_changes.md - griffe check --format=verbose --against=$(git rev-parse origin/main) --search=src "$PACKAGE_NAME" 2>&1 | tee -a breaking_changes.md + griffe check --format=verbose --against="$(git rev-parse origin/main)" --search=src "$PACKAGE_NAME" 2>&1 | tee -a breaking_changes.md - name: Finish writing summary file run: echo "\`\`\`" >> breaking_changes.md - uses: actions/upload-artifact@v4 diff --git a/.github/workflows/_reusable-package-release.yml b/.github/workflows/_reusable-package-release.yml index e18be881..8c71ee40 100644 --- a/.github/workflows/_reusable-package-release.yml +++ b/.github/workflows/_reusable-package-release.yml @@ -87,7 +87,7 @@ jobs: - name: python-versions-array input missing if: ${{ inputs.build-and-publish-python-package == true && (inputs.python-versions-array == null || inputs.python-versions-array == '') }} run: | - echo "The `python-versions-array` input is required when `build-and-publish-python-package` is set to `true`." + echo "The python-versions-array input is required when the build-and-publish-python-package input is set to true." exit 1 - if: ${{ endsWith(github.repository, '/python-package-ci-cd') }} # Run the local action when this is run in the python-package-ci-cd repository uses: ./actions/find_unreleased_changelog_items diff --git a/.github/workflows/_reusable-package-testpypi.yml b/.github/workflows/_reusable-package-testpypi.yml index 8dc916be..b67b579c 100644 --- a/.github/workflows/_reusable-package-testpypi.yml +++ b/.github/workflows/_reusable-package-testpypi.yml @@ -27,13 +27,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - if: ${{ endsWith(github.repository, '/python-package-ci-cd') }} # Run the local action when this is run in the python-package-ci-cd repository - uses: ./actions/create_unique_testpypi_version - id: create-version - with: - package-name: ${{ inputs.package-name }} - - if: ${{ !endsWith(github.repository, '/python-package-ci-cd') }} # Run the public action when this is run outside the python-package-ci-cd repository - uses: tektronix/python-package-ci-cd/actions/create_unique_testpypi_version@v1.0.2 + - uses: tektronix/python-package-ci-cd/actions/create_unique_testpypi_version@v1.0.2 id: create-version with: package-name: ${{ inputs.package-name }} diff --git a/.github/workflows/_reusable-publish-api-comparison.yml b/.github/workflows/_reusable-publish-api-comparison.yml index 91f68fc9..35332c62 100644 --- a/.github/workflows/_reusable-publish-api-comparison.yml +++ b/.github/workflows/_reusable-publish-api-comparison.yml @@ -18,10 +18,10 @@ jobs: path: artifacts - name: Check for breaking changes run: | - if grep -Pzl '\n```\n```' artifacts/breaking_changes.md; then - echo "BREAKING_CHANGES=false" >> $GITHUB_ENV + if grep -Pzl "\n\`\`\`\n\`\`\`" artifacts/breaking_changes.md; then + echo "BREAKING_CHANGES=false" >> "$GITHUB_ENV" else - echo "BREAKING_CHANGES=true" >> $GITHUB_ENV + echo "BREAKING_CHANGES=true" >> "$GITHUB_ENV" fi - name: Fetch PR number id: pr diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e712da96..b80029da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,12 @@ default_stages: [pre-commit] ci: autofix_prs: false autoupdate_schedule: quarterly - skip: [check-poetry, pyright, poetry-audit, markdown-link-check] + skip: + - check-poetry + - pyright + - poetry-audit + - markdown-link-check + - actionlint-docker repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0 @@ -38,6 +43,10 @@ repos: - id: check-github-workflows args: [--verbose] files: ^(\.github/workflows/[^/]+|workflows/[^/]+)$ + - repo: https://github.com/rhysd/actionlint + rev: v1.7.1 + hooks: + - id: actionlint-docker - repo: https://github.com/commitizen-tools/commitizen rev: d7e01aa9b0cfe3c1b732e66d523bbd0656221127 # frozen: v3.29.0 hooks: diff --git a/CHANGELOG.md b/CHANGELOG.md index a22fe99f..ea6e7f94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Valid subsections within a version are: Things to be included in the next release go here. +### Fixed + +- Fixed the `_reusable-package-testpypi.yml` workflow by removing a duplicate step ID that caused the workflow to be unusable + --- ## v1.0.2 (2024-08-27)