From 37da6fd1413c3b2fa9a0d4e1604043ec713d91d1 Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Sat, 19 Sep 2026 14:34:29 +0300 Subject: [PATCH] docs: drop the fetch-depth requirement, semvertag never reads the working tree semvertag/ contains no subprocess call, no git library and no filesystem access. The head commit and the tag list come from the forge REST API, and the bump is decided from that single head commit. No git clone depth can affect the result, so the documented fetch-depth: 0 requirement was never real, and the composite action needs no checkout step at all. README.md and docs/providers/github.md now show the workflow without a checkout step, and the github.md admonition explains that a checkout is only needed when other steps in the job want the repository files. The repo's own dogfood workflow and the PR action-smoke job keep their checkout, which uses: ./ requires, but drop fetch-depth: 0. --- .github/workflows/ci.yml | 2 -- .github/workflows/semvertag.yml | 2 -- README.md | 7 ++----- docs/providers/github.md | 18 +++++------------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4ebb9d..2a63931 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,8 +26,6 @@ jobs: # that bypassed dry-run would be denied by the API. steps: - uses: actions/checkout@v6 - with: - fetch-depth: 0 - id: semvertag uses: ./ with: diff --git a/.github/workflows/semvertag.yml b/.github/workflows/semvertag.yml index 366824e..630abae 100644 --- a/.github/workflows/semvertag.yml +++ b/.github/workflows/semvertag.yml @@ -30,8 +30,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - with: - fetch-depth: 0 - uses: ./ with: dry-run: true diff --git a/README.md b/README.md index f996bc3..94dbb7c 100644 --- a/README.md +++ b/README.md @@ -71,15 +71,12 @@ jobs: tag: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: modern-python/semvertag@v0 ``` semvertag auto-detects GitHub Actions, picks the bump from the latest -commit, and creates the tag ref via the GitHub API. `fetch-depth: 0` -matters — the default `1` misses tag-relative history. See +commit, and creates the tag ref via the GitHub API. It never reads the +working tree, so the job needs no `actions/checkout` step at all. See [GitHub Actions docs](https://github.com/modern-python/semvertag/blob/main/docs/providers/github.md) for token scopes, GitHub Enterprise setup, outputs, and troubleshooting. diff --git a/docs/providers/github.md b/docs/providers/github.md index 4d50c7c..2182b61 100644 --- a/docs/providers/github.md +++ b/docs/providers/github.md @@ -32,9 +32,6 @@ jobs: tag: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: modern-python/semvertag@v0 ``` @@ -49,10 +46,11 @@ without pushing. > `--provider github` is only needed when running outside GHA (e.g. > on a developer laptop targeting a github.com repo). -> **`fetch-depth: 0`** matters: semvertag walks commit history to -> determine the bump. `actions/checkout@v4`'s default -> `fetch-depth: 1` only fetches the single tip commit and will miss -> tag-relative history. +> **No checkout needed.** semvertag reads the head commit and the tag +> history over the GitHub API and never touches the working tree, so +> the job needs neither an `actions/checkout` step nor a `fetch-depth` +> setting. Add a checkout only if other steps in the same job need the +> repository files. ## Strategy @@ -113,9 +111,6 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - id: semvertag uses: modern-python/semvertag@v0 - if: steps.semvertag.outputs.status == 'created' @@ -223,9 +218,6 @@ jobs: tag: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: "3.13"