Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/check-docs-current.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down