From d32d59040fef03b793db9ea146112143ba567002 Mon Sep 17 00:00:00 2001 From: DerTiedemann Date: Wed, 27 Nov 2024 08:17:23 +0100 Subject: [PATCH] tiedemann/changelog action fix (#222) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - **fix: add clean parameter to checkout action** - **fix: add clean and checkout option to changelog action** supercedes #220 --------- Co-authored-by: Yannick Röder --- .github/workflows/bump-version-release.yaml | 1 + actions/changelog-generate/action.yaml | 10 ++++++++++ actions/checkout/action.yaml | 5 +++++ docs/actions/changelog-generate/README.md | 2 ++ docs/actions/checkout/README.md | 1 + 5 files changed, 19 insertions(+) diff --git a/.github/workflows/bump-version-release.yaml b/.github/workflows/bump-version-release.yaml index ef924811f..691c570be 100644 --- a/.github/workflows/bump-version-release.yaml +++ b/.github/workflows/bump-version-release.yaml @@ -58,6 +58,7 @@ jobs: with: ref: ${{ github.event.repository.default_branch }} persist-credentials: false # required for pushing to protected branch later + fetch-depth: 0 # required for changelog generation - name: Bump version id: bump-version diff --git a/actions/changelog-generate/action.yaml b/actions/changelog-generate/action.yaml index 923c969f7..b4f339188 100644 --- a/actions/changelog-generate/action.yaml +++ b/actions/changelog-generate/action.yaml @@ -13,6 +13,14 @@ inputs: description: Path to the changelog file in the GitHub repository required: false default: "CHANGELOG.md" + checkout: + description: "Whether to checkout the repository or not." + required: false + default: "false" + clean: + description: "Clean the repository before running the action." + required: false + default: "false" outputs: merged-changelog: @@ -27,8 +35,10 @@ runs: steps: - name: Check out repository uses: bakdata/ci-templates/actions/checkout@1.49.0 + if: ${{ inputs.checkout == 'true' }} with: fetch-depth: 0 + clean: ${{ inputs.clean }} - name: Get config path id: get-config-path run: | diff --git a/actions/checkout/action.yaml b/actions/checkout/action.yaml index 1eeb15382..f9d49ca01 100644 --- a/actions/checkout/action.yaml +++ b/actions/checkout/action.yaml @@ -25,6 +25,10 @@ inputs: description: "Whether LFS files should be cached. Only has an effect if lfs=true." required: false default: "true" + clean: + description: "Clean the repository before running the action." + required: false + default: "true" submodules: description: "Whether to checkout submodules: `true` to checkout submodules or `recursive` to recursively checkout submodules." required: false @@ -46,6 +50,7 @@ runs: persist-credentials: ${{ inputs.persist-credentials }} submodules: ${{ inputs.submodules }} fetch-depth: ${{ inputs.fetch-depth }} + clean: ${{ inputs.clean }} - name: Create LFS file list if: ${{ inputs.lfs == 'true'}} diff --git a/docs/actions/changelog-generate/README.md b/docs/actions/changelog-generate/README.md index 8f9e7ac9f..700f3c5dc 100644 --- a/docs/actions/changelog-generate/README.md +++ b/docs/actions/changelog-generate/README.md @@ -89,6 +89,8 @@ steps: | INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | | -------------- | ------ | -------- | ---------------- | --------------------------------------------------- | | changelog-file | string | false | `"CHANGELOG.md"` | Path to the changelog file in the GitHub repository | +| checkout | string | false | `"false"` | Whether to checkout the repository or not. | +| clean | string | false | `"false"` | Clean the repository before running the action. | | github-token | string | true | | The GitHub token for committing the changes. | | tag | string | true | | Version after bump | diff --git a/docs/actions/checkout/README.md b/docs/actions/checkout/README.md index c7c33e7f1..5b766ddf7 100644 --- a/docs/actions/checkout/README.md +++ b/docs/actions/checkout/README.md @@ -35,6 +35,7 @@ steps: | INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION | | ------------------- | ------ | -------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------- | | cache | string | false | `"true"` | Whether LFS files should be cached. Only has an effect if lfs=true. | +| clean | string | false | `"true"` | Clean the repository before running the action. | | fetch-depth | string | false | `"1"` | Number of commits to fetch. 0 indicates all history for all branches and tags | | lfs | string | false | `"false"` | Whether LFS files of the repository should be checked out | | persist-credentials | string | false | `"true"` | Whether to configure the token or SSH key with the local git config |