Skip to content

Commit 0d7da96

Browse files
chore: adopt mg-tools v0.9.17 (.github templates + gitignore)
1 parent 26e31a0 commit 0d7da96

7 files changed

Lines changed: 215 additions & 0 deletions

File tree

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Bug report
2+
description: Something broke or behaves unexpectedly.
3+
labels: [bug]
4+
body:
5+
- type: textarea
6+
id: what
7+
attributes:
8+
label: What happened?
9+
description: Describe the behavior you saw.
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: expected
14+
attributes:
15+
label: What did you expect?
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: repro
20+
attributes:
21+
label: Repro steps
22+
description: Minimum steps to reproduce. Commands, inputs, environment.
23+
render: shell
24+
validations:
25+
required: true
26+
- type: input
27+
id: version
28+
attributes:
29+
label: Version / commit
30+
description: "e.g. v0.2.3 or abc123"
31+
- type: textarea
32+
id: context
33+
attributes:
34+
label: Additional context
35+
description: Logs, screenshots, environment notes.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Ask a question (Discussions)
4+
url: https://github.com/makegov/mg-tools/discussions
5+
about: For open-ended questions, use Discussions rather than an issue.

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Feature request
2+
description: Propose a new capability or enhancement.
3+
labels: [enhancement]
4+
body:
5+
- type: textarea
6+
id: problem
7+
attributes:
8+
label: Problem
9+
description: What are you trying to do? What's in the way today?
10+
validations:
11+
required: true
12+
- type: textarea
13+
id: proposal
14+
attributes:
15+
label: Proposal
16+
description: Rough shape of the solution. API, UX, or implementation notes.
17+
validations:
18+
required: true
19+
- type: textarea
20+
id: alternatives
21+
attributes:
22+
label: Alternatives considered
23+
- type: textarea
24+
id: context
25+
attributes:
26+
label: Additional context

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Summary
2+
3+
<!-- What does this PR do, at a glance? 1-3 bullets. -->
4+
5+
-
6+
7+
## Why
8+
9+
<!-- Motivation. Link issues: closes #123, refs #456 -->
10+
11+
## Testing
12+
13+
<!-- How to verify locally / in CI. -->
14+
15+
- [ ]
16+
- [ ]
17+
18+
## Risks / follow-ups
19+
20+
<!-- Anything non-obvious? Migrations? Rollout order? Future cleanup? -->
21+
22+
-
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: changelog-check
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened, ready_for_review]
5+
6+
jobs:
7+
changelog:
8+
name: Verify CHANGELOG entry
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.draft == false
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- name: Check for CHANGELOG diff
16+
run: |
17+
set -e
18+
base="origin/${{ github.base_ref }}"
19+
git fetch --no-tags --depth=50 origin "${{ github.base_ref }}"
20+
changed=$(git diff --name-only "$base...HEAD")
21+
echo "Changed files:"
22+
echo "$changed"
23+
# Skip if only docs/meta files changed.
24+
if echo "$changed" | grep -vE '^(\.github/|docs/|README\.md$|CHANGELOG\.md$|\.gitignore$)' | grep -q .; then
25+
if ! echo "$changed" | grep -qE '^(CHANGELOG\.md|docs/CHANGELOG\.md)$'; then
26+
echo "::error::Source files changed but neither CHANGELOG.md nor docs/CHANGELOG.md updated."
27+
exit 1
28+
fi
29+
fi
30+
echo "OK."

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: ci
2+
on:
3+
pull_request:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
python:
9+
if: hashFiles('pyproject.toml') != ''
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: astral-sh/setup-uv@v4
14+
- run: uv sync --all-extras
15+
- run: uv run ruff check .
16+
- run: uv run ruff format --check .
17+
- run: uv run pytest -x
18+
19+
node:
20+
if: hashFiles('package.json') != ''
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
cache: npm
28+
- run: npm ci
29+
- run: npm run lint --if-present
30+
- run: npm test
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Docs dispatch
2+
3+
# Fires on push to the repo's default branch when content that affects external
4+
# docs (or the public changelog) changes. Notifies the composer repo
5+
# (makegov/docs) via repository_dispatch so it rebuilds without waiting for
6+
# someone to push to docs directly.
7+
#
8+
# Installed by mg-tools into repos whose docsRole is `coloc-source` or
9+
# `editorial-split-source`. For editorial-split repos (e.g. tango), the
10+
# external paths watched are narrower — only docs/CHANGELOG.md and
11+
# docs/internal/** (since the rest of external docs lives in the composer).
12+
#
13+
# Required secrets:
14+
# DOCS_DISPATCH_TOKEN — GitHub token with repo:write on makegov/docs
15+
#
16+
# Required variables (optional):
17+
# DOCS_TARGET_REPO — override target (default: makegov/docs)
18+
#
19+
# On install, mg-tools substitutes the path filters based on docsRole.
20+
21+
on:
22+
push:
23+
branches:
24+
- main
25+
- master
26+
- staging
27+
paths:
28+
- "docs/**"
29+
- "docs/CHANGELOG.md"
30+
- "README.md"
31+
workflow_dispatch:
32+
33+
jobs:
34+
dispatch:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
steps:
39+
- uses: actions/checkout@v4
40+
with:
41+
fetch-depth: 2
42+
43+
- name: Detect changed paths
44+
id: changes
45+
run: |
46+
set -euo pipefail
47+
# Default to all-on-first-commit if there's only one commit in the ref.
48+
base=$(git rev-parse HEAD~1 2>/dev/null || git rev-parse HEAD)
49+
changed=$(git diff --name-only "$base" HEAD | paste -sd, -)
50+
echo "changed=$changed" >> "$GITHUB_OUTPUT"
51+
if [[ -n "$changed" ]]; then
52+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
53+
else
54+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
55+
fi
56+
57+
- name: Dispatch to docs composer
58+
if: steps.changes.outputs.has_changes == 'true'
59+
env:
60+
GH_TOKEN: ${{ secrets.DOCS_DISPATCH_TOKEN }}
61+
TARGET: ${{ vars.DOCS_TARGET_REPO || 'makegov/docs' }}
62+
run: |
63+
gh api "repos/$TARGET/dispatches" \
64+
-f event_type=external_updated \
65+
-f "client_payload[source_repo]=${{ github.repository }}" \
66+
-f "client_payload[source_ref]=${{ github.sha }}" \
67+
-f "client_payload[changed_paths]=${{ steps.changes.outputs.changed }}"

0 commit comments

Comments
 (0)