diff --git a/.github/project-metadata.json b/.github/project-metadata.json new file mode 100644 index 0000000..a7e736e --- /dev/null +++ b/.github/project-metadata.json @@ -0,0 +1,9 @@ +{ + "project_name": "Sandbox App", + "project_summary": "A new Sandbox Application", + "org_repo_url": "N/A", + "project_repo_url": "https://github.com/OSAS/cncf-sandbox-application-template", + "website_url": "https://github.com/OSAS/cncf-sandbox-application-template", + "repository": "OSAS/cncf-sandbox-application-template", + "bootstrapped_at": "2026-09-23T17:45:39Z" +} diff --git a/.github/workflows/sync-checklist-pr.yml b/.github/workflows/sync-checklist-pr.yml index c25ec81..987763a 100644 --- a/.github/workflows/sync-checklist-pr.yml +++ b/.github/workflows/sync-checklist-pr.yml @@ -11,14 +11,20 @@ permissions: jobs: link-pr-on-checklist: runs-on: ubuntu-latest + # Skip bot PRs and re-entry after this workflow pushes to the PR branch. + if: > + github.event.pull_request.user.login != 'github-actions[bot]' && + github.actor != 'github-actions[bot]' steps: - name: Checkout repository uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.ref }} + repository: ${{ github.event.pull_request.head.repo.full_name }} token: ${{ secrets.GITHUB_TOKEN }} - name: Update Issue links to PR links + id: link env: PR_NUMBER: ${{ github.event.pull_request.number }} PR_BODY: ${{ github.event.pull_request.body }} @@ -35,6 +41,7 @@ jobs: if [ -z "${issues}" ]; then echo "No closing keywords found in PR body; skipping." + echo "changed=false" >> "$GITHUB_OUTPUT" exit 0 fi @@ -45,14 +52,19 @@ jobs: python3 scripts/update_checklist_progress.py - - name: Commit checklist PR link updates - run: | if git diff --quiet APPLICATION.md README.md; then echo "No checklist tracking changes." - exit 0 + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "changed=true" >> "$GITHUB_OUTPUT" fi + + - name: Commit checklist PR link updates + if: steps.link.outputs.changed == 'true' + run: | git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git add APPLICATION.md README.md - git commit -m "docs: link checklist items to PR #${{ github.event.pull_request.number }}" + # [skip ci] reduces noise on hosts that honor it; actor guard above is the real loop break. + git commit -m "docs: link checklist items to PR #${{ github.event.pull_request.number }} [skip ci]" git push diff --git a/.github/workflows/sync-checklist.yml b/.github/workflows/sync-checklist.yml index 919f723..c577b52 100644 --- a/.github/workflows/sync-checklist.yml +++ b/.github/workflows/sync-checklist.yml @@ -6,12 +6,14 @@ on: permissions: contents: write - pull-requests: write jobs: sync-checklist: runs-on: ubuntu-latest - if: contains(github.event.issue.labels.*.name, 'checklist-item') + # Ignore closes caused by bot sync noise; only checklist-item issues. + if: > + contains(github.event.issue.labels.*.name, 'checklist-item') && + github.event.issue.user.type != 'Bot' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -32,7 +34,7 @@ jobs: echo "found=true" >> "$GITHUB_OUTPUT" echo "Syncing checklist item: $slug (issue #${{ github.event.issue.number }})" - - name: Update APPLICATION.md checkbox + - name: Mark checkbox complete and update progress if: steps.slug.outputs.found == 'true' id: update env: @@ -47,15 +49,14 @@ jobs: echo "changed=true" >> "$GITHUB_OUTPUT" fi - - name: Create pull request with checklist update + # Commit directly to main. Do not open a follow-up bot PR — that re-triggers + # pull_request workflows and produces approval/noise cascades. + # Commits made with GITHUB_TOKEN do not start new workflow runs. + - name: Commit checklist update to main if: steps.update.outputs.changed == 'true' - uses: peter-evans/create-pull-request@v6 - with: - commit-message: "docs: mark checklist item ${{ steps.slug.outputs.slug }} complete" - title: "docs: sync checklist — ${{ steps.slug.outputs.slug }}" - body: | - Automatically updates [APPLICATION.md](APPLICATION.md) and [README.md](README.md) after checklist issue #${{ github.event.issue.number }} was closed. - - Closes checklist item: `${{ steps.slug.outputs.slug }}` - branch: bot/sync-checklist-${{ steps.slug.outputs.slug }}-${{ github.event.issue.number }} - delete-branch: true + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add APPLICATION.md README.md + git commit -m "docs: mark checklist item ${{ steps.slug.outputs.slug }} complete" + git push origin HEAD:main diff --git a/.github/workflows/validate-pr-closes-issues.yml b/.github/workflows/validate-pr-closes-issues.yml index c639b6c..2409e95 100644 --- a/.github/workflows/validate-pr-closes-issues.yml +++ b/.github/workflows/validate-pr-closes-issues.yml @@ -2,7 +2,7 @@ name: Validate PR closes checklist issues on: pull_request: - types: [opened, edited, synchronize, reopened] + types: [opened, edited, reopened] permissions: issues: write @@ -11,6 +11,7 @@ permissions: jobs: comment-missing-closes: runs-on: ubuntu-latest + if: github.event.pull_request.user.login != 'github-actions[bot]' steps: - name: Check for closing keywords uses: actions/github-script@v7 @@ -25,11 +26,23 @@ jobs: return; } + const marker = ''; + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + }); + if (comments.some(c => c.body && c.body.includes(marker))) { + core.info('Reminder comment already present; skipping.'); + return; + } + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.payload.pull_request.number, body: [ + marker, '### Checklist reminder', '', 'This PR does not reference any checklist issues with closing keywords.', diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f348b6..2ccc20f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,9 +42,9 @@ When the PR merges to the default branch, GitHub closes the linked issue automat ### 4. Checklist sync -The [sync-checklist-pr workflow](.github/workflows/sync-checklist-pr.yml) runs when you open or update a PR with `Closes #N`, replacing `(Issue: …)` with `(PR: …)` in `APPLICATION.md` and README. +The [sync-checklist-pr workflow](.github/workflows/sync-checklist-pr.yml) runs when you open or update a PR with `Closes #N`, replacing `(Issue: …)` with `(PR: …)` in `APPLICATION.md` and README (on your PR branch). -The [sync-checklist workflow](.github/workflows/sync-checklist.yml) runs when a checklist issue is closed. It checks the box in `APPLICATION.md`, refreshes the README dashboard and progress bar, and opens a PR. +The [sync-checklist workflow](.github/workflows/sync-checklist.yml) runs when a checklist issue is closed. It checks the box in `APPLICATION.md`, refreshes the README dashboard and progress bar, and **commits directly to `main`** (no follow-up bot PR). ### 5. Submit to CNCF diff --git a/README.md b/README.md index a0a854d..701400c 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,43 @@ This repository helps you prepare a [CNCF Sandbox application](https://github.co **Edit [APPLICATION.md](APPLICATION.md) only** for checklist answers and form content. This README shows progress and mirrors checklist issue/PR links (updated by automation). +## Quick start + +1. Click **Use this template** to create your own copy of this repository. +2. Clone and bootstrap checklist issues: + + ```bash + git clone git@github.com:YOUR_ORG/YOUR_REPO.git + cd YOUR_REPO + ./scripts/bootstrap-issues.sh + ``` + +3. Commit bootstrap changes and push. +4. Work in **[APPLICATION.md](APPLICATION.md)** only: + 1. complete **Your answer** section + 2. Open a PR with `Closes #N` (issue link is on the checklist line) + 3. make sure you add the proper `field_id` to `Application fields updated` section: e.g. `project_summary`, `maintainers_file`. +5. When every item is complete: + + ```bash + ./scripts/generate-submission.sh --validate + ./scripts/generate-submission.sh --create-issue + ``` + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow. + +## How tracking works + +| Stage | Checklist line shows | +| --- | --- | +| After bootstrap | `(Issue: [#N](…))` — open GitHub issue | +| After you open a PR with `Closes #N` | `(PR: [#N](…))` — in APPLICATION.md and this README | +| After the PR merges | Checkbox `[x]`; issue closes | + ## Application progress -> **Application progress:** **0 / 33** items complete (0%) +> **Application progress:** **0 / 33** items complete (0%) > `░░░░░░░░░░░░░░░░░░░░` 0% @@ -22,7 +55,7 @@ This repository helps you prepare a [CNCF Sandbox application](https://github.co Each row links to the matching section in [APPLICATION.md](APPLICATION.md). `(Issue: …)` becomes `(PR: …)` when you open a pull request with `Closes #N`. -### [read_prerequisites](APPLICATION.md#read_prerequisites) +### [Read Prerequisites](APPLICATION.md#read_prerequisites) - [ ] Reviewed all prerequisite documentation (Issue: #ISSUE_READ_PREREQUISITES) @@ -167,36 +200,6 @@ Each row links to the matching section in [APPLICATION.md](APPLICATION.md). `(Is - [ ] Final review complete and application submitted to CNCF (Issue: #ISSUE_FINAL_REVIEW) -## Quick start - -1. Click **Use this template** to create your own copy of this repository. -2. Clone and bootstrap checklist issues: - - ```bash - git clone git@github.com:YOUR_ORG/YOUR_REPO.git - cd YOUR_REPO - ./scripts/bootstrap-issues.sh - ``` - -3. Commit bootstrap changes and push. -4. Work in **[APPLICATION.md](APPLICATION.md)** only: complete **Your answer**, open a PR with `Closes #N` (issue link is on the checklist line). -5. When every item is complete: - - ```bash - ./scripts/generate-submission.sh --validate - ./scripts/generate-submission.sh --create-issue - ``` - -See [CONTRIBUTING.md](CONTRIBUTING.md) for the full workflow. - -## How tracking works - -| Stage | Checklist line shows | -| --- | --- | -| After bootstrap | `(Issue: [#N](…))` — open GitHub issue | -| After you open a PR with `Closes #N` | `(PR: [#N](…))` — in APPLICATION.md and this README | -| After the PR merges | Checkbox `[x]`; issue closes | - ## References - [CNCF Sandbox repository](https://github.com/cncf/sandbox) diff --git a/scripts/apply_project_info.py b/scripts/apply_project_info.py index 1d0a98b..0a55f40 100755 --- a/scripts/apply_project_info.py +++ b/scripts/apply_project_info.py @@ -19,6 +19,12 @@ def section_prefix_lines(section_lines: List[str]) -> List[str]: """Preserve static guide blocks and checklist lines at the top of a section.""" idx = 0 preserved: List[str] = [] + + # Sections usually start with a blank line after the ## heading. + while idx < len(section_lines) and section_lines[idx].strip() == "": + preserved.append(section_lines[idx]) + idx += 1 + if idx < len(section_lines) and section_lines[idx].strip() == "": while idx < len(section_lines): preserved.append(section_lines[idx]) @@ -26,12 +32,15 @@ def section_prefix_lines(section_lines: List[str]) -> List[str]: idx += 1 break idx += 1 + while idx < len(section_lines) and section_lines[idx].strip() == "": preserved.append(section_lines[idx]) idx += 1 + while idx < len(section_lines) and CHECKLIST_LINE.match(section_lines[idx]): preserved.append(section_lines[idx]) idx += 1 + if idx < len(section_lines) and section_lines[idx].strip() == "": preserved.append(section_lines[idx]) return preserved @@ -69,7 +78,7 @@ def update_readme(content: str, metadata: Dict[str, str]) -> str: f"> **Project name:** {project_name}", ) content = content.replace( - "> **Checklist issues created:** Run `./scripts/bootstrap-issues.sh` after creating your repo from this template.", + "> **Checklist issues:** Run `./scripts/bootstrap-issues.sh` after creating your repo from this template.", "> **Checklist issues:** Bootstrapped", ) content = re.sub( diff --git a/scripts/bootstrap-issues.sh b/scripts/bootstrap-issues.sh index 65f3bfe..b5f9076 100755 --- a/scripts/bootstrap-issues.sh +++ b/scripts/bootstrap-issues.sh @@ -236,20 +236,38 @@ reverse_lines() { } build_checklist_order() { - grep -oE 'checklist:[a-z0-9-]+' "${CHECKLIST_FILE}" \ - | sed 's/checklist://' \ + # Prefer HTML comment markers so prose mentions of "checklist:" are ignored. + grep -oE '' "${CHECKLIST_FILE}" \ + | sed -E 's//\1/' \ | awk '!seen[$0]++' > "${SLUGS_ORDERED_FILE}" } validate_checklist_order() { - local map_slugs app_slugs - map_slugs="$(jq -r 'keys[]' "${MAP_FILE}" | sort)" - app_slugs="$(sort "${SLUGS_ORDERED_FILE}")" - if [[ "${map_slugs}" != "${app_slugs}" ]]; then - echo "Error: checklist slugs in APPLICATION.md do not match checklist-map.json" >&2 - comm -3 <<< "${map_slugs}" <<< "${app_slugs}" | sed 's/^/ /' >&2 - exit 1 + local map_file app_file only_map only_app + map_file="$(mktemp)" + app_file="$(mktemp)" + jq -r 'keys[]' "${MAP_FILE}" | LC_ALL=C sort > "${map_file}" + LC_ALL=C sort "${SLUGS_ORDERED_FILE}" > "${app_file}" + + if cmp -s "${map_file}" "${app_file}"; then + rm -f "${map_file}" "${app_file}" + return 0 fi + + only_map="$(comm -23 "${map_file}" "${app_file}" || true)" + only_app="$(comm -13 "${map_file}" "${app_file}" || true)" + rm -f "${map_file}" "${app_file}" + + echo "Error: checklist slugs in APPLICATION.md do not match checklist-map.json" >&2 + if [[ -n "${only_map}" ]]; then + echo " Present in checklist-map.json but missing from APPLICATION.md:" >&2 + sed 's/^/ - /' <<< "${only_map}" >&2 + fi + if [[ -n "${only_app}" ]]; then + echo " Present in APPLICATION.md but missing from checklist-map.json:" >&2 + sed 's/^/ - /' <<< "${only_app}" >&2 + fi + exit 1 } ensure_labels() {