Skip to content

Commit 18eb377

Browse files
authored
Merge pull request #11 from HackYourFuture/docs/pr-packaging-template
docs+ci: add PR packaging template + enforce it in CI
2 parents b5b6c8b + 376cc1a commit 18eb377

2 files changed

Lines changed: 100 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## What I built
2+
- Staging models: `stg_trips.sql`, `stg_zones.sql` (+ their `_*.yml` tests/descriptions)
3+
- Mart: `fct_daily_borough_stats.sql` at grain one row per (pickup_borough, pickup_date)
4+
- Macro: `safe_divide.sql`
5+
- Singular test: `assert_avg_tip_pct_within_bounds.sql`
6+
- `dbt_utils` declared in `packages.yml`
7+
- Lineage screenshot: `docs/lineage.png`
8+
- Business answers: `reports/answers.md`
9+
- AI usage: `AI_ASSIST.md`
10+
11+
## How to review
12+
- Models: read `models/marts/fct_daily_borough_stats.sql` (grain + measures) and the staging models.
13+
- Lineage: `docs/lineage.png`.
14+
- Answers: `reports/answers.md`.
15+
- AI usage: `AI_ASSIST.md`.
16+
17+
## How to run
18+
From a clean clone, with your own Postgres access:
19+
20+
```bash
21+
cp profiles.yml.example profiles.yml # set schema to dev_<your_name>
22+
cp .env.example .env # fill PG_HOST, PG_USER, PG_PASSWORD
23+
source .env
24+
dbt deps
25+
dbt build # runs models + tests
26+
```
27+
28+
`dbt debug` must end with `All checks passed!` first.
29+
30+
> Data dependency: this builds into **your own** `dev_<name>` schema on the shared Postgres. A reviewer without that access relies on `docs/lineage.png` and `reports/answers.md` as the canonical evidence.
31+
32+
## What reviewers should see (expected results)
33+
Fill in what your build actually produces:
34+
- `dbt build` result: <e.g. PASS=NN WARN=1 ERROR=0>
35+
- `fct_daily_borough_stats` row count: <e.g. ~180>
36+
- Grain: one row per (pickup_borough, pickup_date)
37+
- One business answer sample: <e.g. Manhattan has the most trips>
38+
39+
## Known limitations / out of scope
40+
- <e.g. the singular test WARNs rather than errors by design; incremental not implemented>
41+
- Write "none" if everything in the assignment is done and working.
42+
43+
## Self-check
44+
- [ ] `bash .hyf/test.sh` passes
45+
- [ ] `dbt build` completes with no ERROR
46+
- [ ] `fct_daily_borough_stats` exists as a **table** at the stated grain
47+
- [ ] No credentials committed (`profiles.yml` / `.env` are gitignored)
48+
- [ ] `docs/lineage.png` is committed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: PR body check
2+
3+
# Fails the check when a pull request description is missing the sections from
4+
# .github/PULL_REQUEST_TEMPLATE.md. GitHub only auto-fills that template in the
5+
# web "compose" form and in `gh pr create` with no --body; a PR opened through
6+
# the REST API or `gh pr create --body "..."` (the path most AI tools take)
7+
# silently skips it. This check is the only thing that actually enforces it.
8+
#
9+
# Recovery is automatic: editing the PR description fires the `edited` event and
10+
# re-runs this check with the new body. No new commit or manual re-run needed.
11+
12+
on:
13+
pull_request:
14+
types: [opened, edited, reopened, synchronize]
15+
branches: [main]
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
check:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check required sections are present
25+
env:
26+
PR_BODY: ${{ github.event.pull_request.body }}
27+
run: |
28+
set -euo pipefail
29+
required=(
30+
"## What I built"
31+
"## How to review"
32+
"## How to run"
33+
"## What reviewers should see"
34+
"## Self-check"
35+
)
36+
missing=()
37+
for section in "${required[@]}"; do
38+
if ! printf '%s' "$PR_BODY" | grep -qiF "$section"; then
39+
missing+=("$section")
40+
fi
41+
done
42+
if [ ${#missing[@]} -ne 0 ]; then
43+
echo "::error::Your PR description is missing required sections. Start from the template (.github/PULL_REQUEST_TEMPLATE.md) and keep these headings:"
44+
for m in "${missing[@]}"; do echo " - $m"; done
45+
echo ""
46+
echo "If you (or an AI tool) opened this PR without the template, click 'Edit' on the"
47+
echo "PR description, paste the template, and fill it in. Editing the description"
48+
echo "re-runs this check automatically. A complete PR is easy to review and"
49+
echo "reproducible: that is part of the assignment."
50+
exit 1
51+
fi
52+
echo "All required PR sections present."

0 commit comments

Comments
 (0)