Skip to content

Commit f16f4a8

Browse files
locus313Copilot
andcommitted
feat: add composite actions, automated releases, and Conventional Commits workflow
- Add action.yml for all 16 automation scripts (enables uses: in GitHub Actions workflows and Dependabot version tracking) - Add Release Please workflow for automated releases on push to main - Add release-please-config.json, .release-please-manifest.json, and VERSION bootstrap files - Remove update-readme-sha.yml (superseded by release tags) - fix: make REPORT_DIR overridable via env var in github-archive-old-repos - docs: restructure GitHub Actions section in README to lead with composite action syntax; add Available Actions table - docs: update Contributing guide with action.yml step and Conventional Commits requirement - docs: mandate Conventional Commits in AGENTS.md and copilot-instructions.md; CHANGELOG.md is now fully managed by Release Please Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent dc4d6c4 commit f16f4a8

26 files changed

Lines changed: 823 additions & 169 deletions

File tree

.github/copilot-instructions.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,31 @@ Uses API version `2026-03-10` and the new usage-metrics NDJSON endpoints (signed
218218
2. Create script: `github-<action-verb-object>.sh` (match directory name)
219219
3. Source `lib/github-common.sh` for validation and output helpers
220220
4. Start with the standard boilerplate (see Script Anatomy above)
221-
5. Document in README.md following existing format:
221+
5. Create `action.yml` in the same directory — expose every env var as a named input (required inputs without defaults, optional inputs with sensible defaults); map CLI flags such as `--dry-run` and `--type` to boolean/string inputs and build an `ARGS` array in the `run:` step. Mirror the pattern of any existing `action.yml`.
222+
6. Document in README.md following existing format:
222223
- Use case description
223224
- Required variables table
224225
- Usage example with exports
225226
- Output format (if applicable)
227+
- Add a row to the Available Actions table in the "Using Scripts in GitHub Actions" section
226228

227229
### Testing Approach
228230
- **Always test on a test organization first**
231+
232+
### Commit Messages — Conventional Commits (required)
233+
234+
All commits **must** follow [Conventional Commits](https://www.conventionalcommits.org/). Release Please reads commit messages to auto-generate `CHANGELOG.md` and determine the version bump. Never update `CHANGELOG.md` manually.
235+
236+
| Prefix | Effect | Example |
237+
|--------|--------|---------|
238+
| `feat:` | minor bump | `feat: add REPO_NAME_FILTER to github-add-repo-permissions` |
239+
| `fix:` | patch bump | `fix: make REPORT_DIR overridable in github-archive-old-repos` |
240+
| `feat!:` / `BREAKING CHANGE:` | major bump | `feat!: rename ENTERPRISE_SLUG to ENTERPRISE` |
241+
| `docs:` | patch bump (visible) | `docs: update GitHub Actions examples in README` |
242+
| `chore:` | no bump (hidden) | `chore: update actions/checkout to v7` |
243+
| `ci:` | no bump (hidden) | `ci: pin release-please-action SHA` |
244+
| `refactor:` | no bump (hidden) | `refactor: extract pagination helper` |
245+
229246
### Variable Naming Conventions
230247
- `GITHUB_TOKEN` — main admin token
231248
### Dependencies
@@ -243,22 +260,23 @@ Keep new scripts dependency-minimal; document any non-standard dependencies expl
243260
7. **URL encoding:** Labels in API calls must be URL-encoded (`Linked [AC]``Linked%20[AC]`)
244261
8. **Public repo filtering:** Do not rely on `?type=public` for enterprise-managed orgs — fetch all and filter in jq
245262
9. **macOS vs Linux date:** `github-archive-old-repos.sh` handles both BSD `date -v` (macOS) and GNU `date -d` (Linux)
263+
10. **Never edit CHANGELOG.md manually** — it is fully managed by Release Please via Conventional Commits
246264

247265
## Maintenance Matrix
248266

249267
When you change one of these files, you must also update the files in the "Also update" column.
250268

251269
| When you change… | Also update |
252270
|------------------|-------------|
253-
| `lib/github-common.sh` — any public function signature or behaviour | All 19 scripts that source it; verify each caller still passes the right arguments. Check with: `grep -r "source.*github-common" . --include="*.sh"` |
271+
| `lib/github-common.sh` — any public function signature or behaviour | All 18 scripts that source it; verify each caller still passes the right arguments. Check with: `grep -r "github-common" . --include="*.sh"` |
254272
| `lib/github-common.sh` — add a new helper function | `AGENTS.md` shared library table; `README.md` if the function affects usage |
255-
| Any script's required env vars | That script's `# ===` header comment; the corresponding README.md section's env var table |
256-
| Any script's optional env vars or defaults | Same as above |
257-
| Any script's `--dry-run` or CLI flag behaviour | README.md usage example for that script |
273+
| Any script's required env vars | That script's `# ===` header comment; the corresponding README.md section's env var table; that script's `action.yml` inputs (add/remove required inputs to match) |
274+
| Any script's optional env vars or defaults | Same as above; update the `action.yml` optional inputs and their defaults |
275+
| Any script's `--dry-run` or CLI flag behaviour | README.md usage example for that script; that script's `action.yml` inputs and `run:` step flag construction |
258276
| `README.md` — script documentation | Verify the script's `# ===` header comment still matches (env vars, options, requirements) |
259277
| `.githooks/pre-commit` | `install-hooks.sh` if hook path or installation instructions change; README.md Best Practices section |
260278
| `install-hooks.sh` | README.md Installation section |
261-
| Add a new script | `README.md` (add use case, env var table, usage example); `CHANGELOG.md` under `[Unreleased]` |
279+
| Add a new script | `action.yml` in the same directory; `README.md` (add use case, env var table, usage example, Available Actions table row) |
262280
| Add a new domain folder | `README.md` top-level structure description; `AGENTS.md` Repository Structure section |
263281
| `.github/workflows/ci.yml` — shellcheck flags | `.githooks/pre-commit` shellcheck invocation (keep them in sync) |
264282
| `.github/workflows/copilot-setup-steps.yml` — tool versions | `AGENTS.md` Tech Stack table |

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5
17+
with:
18+
release-type: simple

.github/workflows/update-readme-sha.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.0.0"
3+
}

AGENTS.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ github-api-scripts/
5252
| git | Used in `github-import-repo` for bare clone + mirror push |
5353
| shellcheck | Linting (pre-commit hook + CI) |
5454
| gitleaks | Secret scanning (pre-commit hook) |
55+
| Release Please | Automated releases and CHANGELOG generation (`.github/workflows/release.yml`) |
5556

5657
---
5758

@@ -177,8 +178,9 @@ done
177178
3. **Copy the header template** from Script Anatomy above — fill in description, all env vars, requirements
178179
4. **Source the shared library** using `SCRIPT_DIR`
179180
5. **Validate all inputs** before any API calls
180-
6. **Add to README.md** — follow the existing format: use case, env var table, usage example, output format
181-
7. Place in the correct domain:
181+
6. **Create `action.yml`** in the same directory — expose every env var as an input (required inputs first, optional inputs with defaults); map CLI flags (`--dry-run`, `--type`, etc.) to boolean/string inputs and construct the `ARGS` array in the `run:` step. See existing `action.yml` files for the pattern.
182+
7. **Add to README.md** — follow the existing format: use case, env var table, usage example, output format; add a row to the Available Actions table in the "Using Scripts in GitHub Actions" section
183+
8. Place in the correct domain:
182184
- `org-admin/` — organization-level operations (repos, teams, members)
183185
- `enterprise/` — enterprise-level operations (licenses, org enumeration)
184186
- `reporting/` — read-only reports and audits
@@ -192,6 +194,24 @@ done
192194
- **Install:** `./install-hooks.sh` or `git config core.hooksPath .githooks`
193195
- **Bypass (emergency only):** `git commit --no-verify`
194196
- **CI:** shellcheck runs on all `.sh` files on every PR (`.github/workflows/ci.yml`)
197+
- **Releases:** automated by Release Please (`.github/workflows/release.yml`) — pushes to `main` trigger a release PR; merging it publishes the GitHub Release and tag
198+
199+
## Commit Messages — Conventional Commits (required)
200+
201+
All commits **must** follow [Conventional Commits](https://www.conventionalcommits.org/). `CHANGELOG.md` is fully managed by Release Please and **must never be edited manually**.
202+
203+
| Prefix | Version bump | Visible in changelog |
204+
|--------|-------------|----------------------|
205+
| `feat:` | minor | ✅ Features |
206+
| `fix:` | patch | ✅ Bug Fixes |
207+
| `docs:` | patch | ✅ Documentation |
208+
| `perf:` | patch | ✅ Performance Improvements |
209+
| `revert:` | patch | ✅ Reverts |
210+
| `feat!:` / `BREAKING CHANGE:` | major ||
211+
| `chore:` | none | hidden |
212+
| `ci:` | none | hidden |
213+
| `refactor:` | none | hidden |
214+
| `test:` | none | hidden |
195215

196216
---
197217

@@ -205,3 +225,4 @@ done
205225
- **Public repo filtering:** Do not rely on `?type=public` for enterprise-managed orgs — fetch all and filter in `jq`
206226
- **macOS vs Linux date:** `github-archive-old-repos.sh` handles both BSD `date -v` and GNU `date -d`
207227
- **`set -euo pipefail`:** Must be the first executable line after the header — never omit it
228+
- **Never edit `CHANGELOG.md` manually** — it is fully managed by Release Please via Conventional Commits

CHANGELOG.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,35 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
5+
This changelog is automatically maintained by [Release Please](https://github.com/googleapis/release-please) using [Conventional Commits](https://www.conventionalcommits.org/). Do not edit the versioned sections manually.
66

7-
## [Unreleased]
8-
9-
### Added
10-
- `github-install-enterprise-app` — programmatically installs an enterprise-owned automation GitHub App into an org using an installer GitHub App (JWT → installation token flow); supports `--dry-run` and optional org-scoped token verification. Adds `openssl` as a dependency
11-
- `github-copilot-report`: NDJSON usage-metrics endpoints, Entra ID enrichment via `az rest`, auto-detection of credits per seat with promo/standard table, `--no-entra` flag
12-
- README: GitHub Actions integration examples (workflow_dispatch, artifact upload, environment protection)
13-
- `.github/workflows/update-readme-sha.yml` — automatically updates the pinned commit SHA in README.md on every push to `main`
14-
15-
### Changed
16-
- README: updated all `actions/checkout` references from `v4` to `v7.0.0` (pinned SHA `9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0`)
17-
- README: replaced `ref: main` in the GitHub Actions usage example with a pinned commit SHA, and updated the accompanying note to recommend SHA pinning
7+
<!-- Release Please inserts new entries above this line -->
188

199
---
2010

21-
## [2026-06-21]
11+
## Pre-release history
2212

23-
### Added
24-
- `github-copilot-report`: NDJSON usage-metrics endpoints, Entra ID enrichment via `az rest`, auto-detection of credits per seat with promo/standard table, `--no-entra` flag
25-
- README: GitHub Actions integration examples (workflow_dispatch, artifact upload, environment protection)
13+
### 2026-06-26
2614

27-
### Changed
28-
- Validated all required environment variables across all scripts before any API calls
29-
- Improved error handling with descriptive exit messages throughout
15+
- feat: composite `action.yml` for all 16 automation scripts — each script is now usable as a `uses:` step in GitHub Actions workflows, enabling Dependabot to track and bump version pins automatically
16+
- feat: Release Please workflow for automated releases on push to `main`
17+
- feat: `github-install-enterprise-app` — programmatically installs an enterprise-owned GitHub App using a second installer app (JWT flow); supports `--dry-run`
18+
- feat: `github-copilot-report` — Copilot usage report with Entra ID enrichment, AI credit accounting, and new usage-metrics endpoints
19+
- fix: `github-archive-old-repos``REPORT_DIR` is now overridable via environment variable
20+
- chore: remove `update-readme-sha.yml` workflow (superseded by release tags)
21+
- docs: GitHub Actions section in README restructured to lead with composite action `uses:` syntax
3022

31-
---
23+
### 2026-06-21
3224

33-
## [2026-06-20]
25+
- feat: `github-copilot-report` — NDJSON usage-metrics endpoints, Entra ID enrichment via `az rest`, credits per seat auto-detection
26+
- docs: GitHub Actions integration examples (workflow_dispatch, artifact upload, environment protection)
27+
- fix: validated all required environment variables across all scripts before any API calls
3428

35-
### Added
36-
- `github-add-repo-permissions`: `REPO_NAME_FILTER` option to restrict permission grants to repos matching a name prefix
29+
### 2026-06-20
3730

38-
### Changed
39-
- Enhanced validation for user-supplied inputs (slugs, regex patterns, date formats) across multiple scripts
40-
- Improved payload handling and JSON construction in enterprise scripts
31+
- feat: `github-add-repo-permissions``REPO_NAME_FILTER` option to restrict permission grants to repos matching a name prefix
32+
- fix: enhanced validation for user-supplied inputs (slugs, regex patterns, date formats) across multiple scripts
4133

42-
---
4334

4435
## [2026-06-19]
4536

0 commit comments

Comments
 (0)