Skip to content

Commit 609a7e5

Browse files
committed
fix: close merged submission issues
1 parent 9f862f8 commit 609a7e5

4 files changed

Lines changed: 36 additions & 1 deletion

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Close Merged Theme Submission Issue
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
issues: write
9+
pull-requests: read
10+
11+
jobs:
12+
close_issue:
13+
if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'submissions/theme-') }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Close source issue
17+
env:
18+
GH_TOKEN: ${{ github.token }}
19+
PR_BODY: ${{ github.event.pull_request.body }}
20+
PR_NUMBER: ${{ github.event.pull_request.number }}
21+
shell: bash
22+
run: |
23+
issue_number="$(printf '%s' "$PR_BODY" | sed -nE 's/^Generated from #([0-9]+)\.$/\1/p' | head -n 1)"
24+
25+
if [ -z "$issue_number" ]; then
26+
echo "No source issue number found in PR #${PR_NUMBER}."
27+
exit 0
28+
fi
29+
30+
gh issue close "$issue_number" \
31+
--comment "Theme submission was merged in #${PR_NUMBER}. Thanks for sharing it."

MEMORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@ This file stores durable project context so future conversations can resume work
3535
- `.github/workflows/check-themes.yml`
3636
- `.github/workflows/create-theme-submission.yml`
3737
- `.github/workflows/publish-approved-theme-submission.yml`
38+
- `.github/workflows/close-merged-theme-submission.yml`
3839
- CI workflows now opt into Node 24 for JavaScript actions explicitly and use `actions/checkout@v6` plus `actions/setup-node@v6`
3940
- Build workflow runs automatically on pushes to `main` that affect Astro site/build inputs and deploys `dist/` through GitHub Pages artifacts
4041
- PR validation runs `npm test` and `npm run build` for site-related changes
4142
- Theme submission automation uses GitHub Issue Forms plus `.github/workflows/create-theme-submission.yml`; it creates candidate PRs from complete submission issues without Decap or external auth hosting
4243
- Approved submission PRs are finalized by `.github/workflows/publish-approved-theme-submission.yml`, which sets `status: "published"` and assigns the next available low `catalogIndex`; maintainers still merge the PR explicitly
44+
- Merged submission PRs close their source issue through `.github/workflows/close-merged-theme-submission.yml`; new generated PR bodies also include `Closes #<issue>`
4345
- The build workflow syntax also requires `workflow_dispatch:` with a trailing colon; missing it makes GitHub mark the workflow file as invalid even if other checks still pass
4446

4547
## Repo Notes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Community submissions use the `Submit a theme` GitHub Issue Form. When a complet
4242
- validate the catalog with `npm test` and `npm run build`;
4343
- open or update a review pull request from a `submissions/theme-<issue-number>` branch.
4444

45-
The generated entry remains `status: "candidate"` until a maintainer approves the submission PR. Approval runs `.github/workflows/publish-approved-theme-submission.yml`, which switches the entry to `status: "published"` and assigns the next available `catalogIndex`. Maintainers still merge the PR explicitly after checks pass.
45+
The generated entry remains `status: "candidate"` until a maintainer approves the submission PR. Approval runs `.github/workflows/publish-approved-theme-submission.yml`, which switches the entry to `status: "published"` and assigns the next available `catalogIndex`. Maintainers still merge the PR explicitly after checks pass. Merged submission PRs close their source issue automatically.
4646

4747
## Metadata Refresh
4848

scripts/create-theme-submission-from-issue.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,8 @@ function prBody({ theme, notes, issueNumber, issueAuthor, screenshotUrls }) {
324324
325325
Generated from #${issueNumber}.
326326
327+
Closes #${issueNumber}.
328+
327329
- Title: ${theme.title}
328330
- Slug: \`${theme.slug}\`
329331
- Repository: ${theme.repository}

0 commit comments

Comments
 (0)