Skip to content
Closed
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
57 changes: 56 additions & 1 deletion .github/workflows/check-docs-current.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,63 @@ name: Check docs current
on:
workflow_call:

permissions:
contents: write

jobs:
scaffold-changes-template:
# Runs once, when the PR is first opened, to drop a copy-paste-ready
# .changes/*.yml template into the branch. Skipped for fork PRs.
if: >-
github.event.action == 'opened' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Checkout PR branch
run: |
git checkout -B "$BRANCH_NAME" "origin/$BRANCH_NAME"
git pull --rebase origin "$BRANCH_NAME"
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}

- name: Skip if a changes entry or template already exists
id: existing
run: |
if ls .changes/*.yml >/dev/null 2>&1 || [ -f ".changes/TODO.yml.template" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi

- name: Download changes-template.yml
if: steps.existing.outputs.skip == 'false'
# Hardcoded to the changelog POC test branch for now (see GA-1035597).
# Update this ref once that work lands on main.
run: |
mkdir -p .changes
curl -sSfL \
"https://raw.githubusercontent.com/fivetran/dbt_package_automations/refs/heads/changelog-poc/initial-test/templates/changes-template.yml" \
-o .changes/TODO.yml.template

- name: Commit and push the template
if: steps.existing.outputs.skip == 'false'
run: |
git config --global user.name "fivetran-data-model-bot"
git config --global user.email "fivetran-data-model-bot@users.noreply.github.com"
git add .changes/TODO.yml.template
git commit -m "Add .changes/*.yml template" || echo "No changes to commit"
git push origin "$BRANCH_NAME"
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}

check-docs:
if: github.event.action != 'opened'
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -42,7 +97,7 @@ jobs:

RELEVANT_DOCS=$(relevant_since_last_touch 'docs/')
RELEVANT_CHANGELOG=$(relevant_since_last_touch 'CHANGELOG.md')
RELEVANT_CHANGES_YML=$(relevant_since_last_touch '.changes/')
RELEVANT_CHANGES_YML=$(relevant_since_last_touch '.changes/*.yml')

echo "BASE: $BASE"
echo "HEAD: $HEAD"
Expand Down
6 changes: 4 additions & 2 deletions 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 three things on every PR push: docs regenerated, `CHANGELOG.md` updated, and a `.changes/*.yml` entry present. Reports a single `docs/generated` commit status naming specifically which of the three are missing, and removes the `docs:ready` label if any are stale
- `check-docs-current.yml` – When a PR is opened, drops a `.changes/TODO.yml.template` into the branch if no `.changes/*.yml` entry exists yet (skipped for fork PRs). On every subsequent push, checks three things: docs regenerated, `CHANGELOG.md` updated, and a `.changes/*.yml` entry present. Reports a single `docs/generated` commit status naming specifically which of the three are missing, and removes the `docs:ready` label if any are stale
- `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 Expand Up @@ -94,4 +94,6 @@ contributors:

Only `version` is required — omit any section with nothing to report for this release. A blank,
copy-paste-ready starting point lives at
[`templates/changes-template.yml`](templates/changes-template.yml).
[`templates/changes-template.yml`](templates/changes-template.yml), and `check-docs-current.yml`
automatically drops a copy into new PRs as `.changes/TODO.yml.template` (the `.yml.template`
extension is deliberate — it's never picked up as a release until renamed to `.changes/{version}.yml`).