From 19a45fcec069cb1252ca91a433de52e1364a6f34 Mon Sep 17 00:00:00 2001 From: Catherine Fritz <111930712+fivetran-catfritz@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:25:21 -0600 Subject: [PATCH] Keep docs:ready when it was applied after the docs check started Since changelog entries moved to .changes/*.yml, the usual flow is to push the entry and apply docs:ready seconds later. The check for that push then removed the label even though it had already started a docs run, so the label no longer reflected that docs were current. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/check-docs-current.yml | 19 +++++++++++++++++++ README.md | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-docs-current.yml b/.github/workflows/check-docs-current.yml index 8a640b7..a1ad6a9 100644 --- a/.github/workflows/check-docs-current.yml +++ b/.github/workflows/check-docs-current.yml @@ -96,7 +96,26 @@ jobs: - name: Remove docs:ready label if anything is stale or missing if: steps.check.outputs.state == 'failure' + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | + # A label applied after this check was triggered already started a docs + # run for this commit, so leave it - generate-docs.yml removes it if that + # run fails. A re-run is measured from when the re-run started. + CHECK_STARTED=$(gh api "repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + --jq 'if .run_attempt > 1 then .run_started_at else .created_at end' || true) + LABELED_AT=$(gh api --paginate "repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/timeline" \ + --jq '.[] | select(.event == "labeled" and .label.name == "docs:ready") | .created_at' | tail -1 || true) + + echo "Check started: $CHECK_STARTED" + echo "docs:ready last applied: ${LABELED_AT:-never}" + + # ISO 8601 UTC timestamps compare correctly as strings + if [[ -n "$CHECK_STARTED" && -n "$LABELED_AT" && "$LABELED_AT" > "$CHECK_STARTED" ]]; then + echo "docs:ready was applied after this check started - leaving it for the docs run" + exit 0 + fi + curl -s -o /dev/null -X DELETE \ -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/docs:ready" diff --git a/README.md b/README.md index 5137e28..7ef62f5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository includes: - **GitHub Actions workflows** (`/.github/workflows/`) - `auto-release.yml` – Automates GitHub release creation - - `check-docs-current.yml` – Checks two things on every PR push: docs regenerated since the last relevant change (which also covers `CHANGELOG.md`, since both are rebuilt in the same job), and a `.changes/*.yml` entry present in the PR. Reports a single `docs/generated` commit status naming specifically what's missing, and removes the `docs:ready` label if anything is + - `check-docs-current.yml` – Checks two things on every PR push: docs regenerated since the last relevant change (which also covers `CHANGELOG.md`, since both are rebuilt in the same job), and a `.changes/*.yml` entry present in the PR. Reports a single `docs/generated` commit status naming specifically what's missing, and removes the `docs:ready` label if anything is stale or missing. A label applied after the check started is left in place, since it already started a docs run for that commit - `generate-docs.yml` – When the `docs:ready` label is applied, generates dbt documentation **and** runs the changelog update (see below) in one job, committing both to the PR branch in a single push. Reports a `docs/generated` failure status and removes the `docs:ready` label if either step fails ## Changelog generation