Skip to content

Commit 7159cd6

Browse files
committed
feat: internal and external release triggered workflows
1 parent b20f9d2 commit 7159cd6

12 files changed

Lines changed: 472 additions & 264 deletions

‎docs/examples/configuration-sources/README.md‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ reusable actions in this repository at commit
1313
| [`local/`](local/) | `local` | `.opencode/configuration/local-documentation-review/`, `.opencode/configuration/local-issue-feedback/`, and `.opencode/configuration/local-release-project-review/` | Keep repository-specific reviewed instructions with the consumer. |
1414
| [`central/`](central/) | `central` | None | Use the centrally approved profiles hosted by the central config repository, defined by this repository. |
1515

16-
Each directory contains `documentation-review.yml`, `issue-feedback.yml`, and
17-
`release-project-review.yml`. Keep only the workflows needed by the consumer
18-
repository.
16+
Each directory contains `documentation-review.yml`, `issue-feedback.yml`,
17+
`release-project-review-self.yml`, and `external-release-project-review.yml`.
18+
Keep only the workflows needed by the consumer repository.
1919

2020
All three examples start in `validate_only` mode so they can be enabled
2121
safely. After verifying the resolution artifact, change `validate_only: true`
@@ -27,20 +27,30 @@ issue feedback needs `issues: write`; release project review needs
2727
`release_target_token` with `contents: read` and `issues: write` on the target
2828
repository.
2929

30-
`release-project-review.yml` is manual/reusable only (`workflow_dispatch` and
31-
`workflow_call`). It examines a published GitHub release identified by a
32-
release ID or tag and creates at most one `release-readiness` issue in the
33-
reviewed repository when it finds material release-planning or
34-
project-management gaps. It never runs automatically on a release event.
30+
`release-project-review-self.yml` runs when a release is published in the
31+
repository containing the workflow. It forwards the event's release ID to the
32+
reusable workflow and creates at most one `release-readiness` issue when it
33+
finds material release-planning or project-management gaps.
34+
35+
`external-release-project-review.yml` runs daily at midnight UTC. Before using
36+
it, replace `OWNER/REPOSITORY` in both the discovery job and reusable-workflow
37+
inputs, and configure `release_target_token` with `contents: read` and
38+
`issues: write` on that target repository. The scheduled job selects the most
39+
recent non-draft target release published during the preceding 24 hours and
40+
skips the review when no such release exists. It can also be dispatched
41+
manually: provide `target_repository` and optionally `release_id`. A supplied
42+
release ID bypasses discovery; without one, the workflow resolves the target's
43+
latest published release.
3544

3645
The remote workflow and remote configuration reference are pinned to complete
3746
commit SHAs. Each SHA must be reviewed in the repository it references. For
3847
the `default` source, the configuration bundle is in this workflow repository,
3948
so its `configuration_ref` matches the `uses:` SHA. For the `central` source,
4049
`configuration_ref` instead pins the approved bundle in
4150
`SecondSkoll/generic-agentic-workflows-config`; it is independent of the
42-
workflow `uses:` SHA. The `release-project-review.yml` workflow pin must point
43-
to a reviewed release commit containing
51+
workflow `uses:` SHA. The `release-project-review-self.yml` and
52+
`external-release-project-review.yml` workflow pins must point to a reviewed
53+
release commit containing
4454
`.github/workflows/opencode-release-project-review.yml`. The placeholder
4555
workflow pin shown in these examples (`61ed1bbd…`) predates the release
4656
project-review work and is a format placeholder only; replace it with a real
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: External release project review (central configuration)
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
inputs:
8+
target_repository:
9+
description: Canonical owner/repository of the external release to review
10+
type: string
11+
required: true
12+
release_id:
13+
description: Optional positive release ID; defaults to the target's latest release
14+
type: string
15+
required: false
16+
default: ''
17+
18+
permissions:
19+
contents: read
20+
issues: write
21+
22+
jobs:
23+
find-scheduled-release:
24+
name: Find target release published in the last 24 hours
25+
if: github.event_name == 'schedule'
26+
runs-on: ubuntu-latest
27+
outputs:
28+
release_id: ${{ steps.find-release.outputs.release_id }}
29+
env:
30+
# Replace this placeholder with the canonical target owner/repository.
31+
TARGET_REPOSITORY: OWNER/REPOSITORY
32+
GH_TOKEN: ${{ secrets.release_target_token }}
33+
steps:
34+
- id: find-release
35+
name: Select most recent published release
36+
run: |
37+
set -euo pipefail
38+
gh api "/repos/$TARGET_REPOSITORY/releases?per_page=100" > releases.json
39+
release_id=$(python3 - <<'PY'
40+
import datetime as dt
41+
import json
42+
43+
now = dt.datetime.now(dt.timezone.utc)
44+
cutoff = now - dt.timedelta(hours=24)
45+
releases = json.load(open("releases.json", encoding="utf-8"))
46+
recent = []
47+
for release in releases:
48+
published_at = release.get("published_at")
49+
if release.get("draft") or not isinstance(published_at, str):
50+
continue
51+
published = dt.datetime.fromisoformat(published_at.replace("Z", "+00:00"))
52+
if cutoff <= published <= now:
53+
recent.append((published, release["id"]))
54+
print(max(recent, default=(None, ""))[1])
55+
PY
56+
)
57+
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
58+
59+
find-dispatch-release:
60+
name: Find latest target release for dispatch
61+
if: github.event_name == 'workflow_dispatch' && inputs.release_id == ''
62+
runs-on: ubuntu-latest
63+
outputs:
64+
release_id: ${{ steps.find-release.outputs.release_id }}
65+
env:
66+
TARGET_REPOSITORY: ${{ inputs.target_repository }}
67+
GH_TOKEN: ${{ secrets.release_target_token }}
68+
steps:
69+
- id: find-release
70+
name: Select latest published release
71+
run: |
72+
set -euo pipefail
73+
release_id=$(gh api "/repos/$TARGET_REPOSITORY/releases/latest" --jq '.id')
74+
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
75+
76+
release-review:
77+
if: >-
78+
always() && (inputs.release_id != '' ||
79+
needs.find-dispatch-release.outputs.release_id != '' ||
80+
needs.find-scheduled-release.outputs.release_id != ''
81+
)
82+
needs: [find-scheduled-release, find-dispatch-release]
83+
uses: SecondSkoll/generic-agentic-workflows/.github/workflows/opencode-release-project-review.yml@61ed1bbd34a878f3ae270b1e4ff027cf786b730b
84+
permissions:
85+
contents: read
86+
issues: write
87+
with:
88+
target_repository: ${{ inputs.target_repository || 'OWNER/REPOSITORY' }}
89+
release_id: ${{ inputs.release_id || needs.find-dispatch-release.outputs.release_id || needs.find-scheduled-release.outputs.release_id }}
90+
configuration_source: central
91+
# Pin this SHA in SecondSkoll/generic-agentic-workflows-config.
92+
configuration_ref: 9b35f1fc2860a1d6b8f1abaa9b467dc4eb42aec8
93+
configuration_profile: release-project-review
94+
validate_only: true
95+
secrets:
96+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
97+
release_target_token: ${{ secrets.release_target_token }}
98+
central_config_token: ${{ secrets.central_config_token }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release project review (self, central configuration)
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
issues: write
10+
11+
jobs:
12+
release-review:
13+
# The pin below must point to a reviewed release commit that contains both
14+
# the reusable workflow and the supplied release-project-review profile.
15+
# The placeholder SHA shown predates the release project-review work and is
16+
# a format placeholder only; replace it before enabling this workflow.
17+
uses: SecondSkoll/generic-agentic-workflows/.github/workflows/opencode-release-project-review.yml@61ed1bbd34a878f3ae270b1e4ff027cf786b730b
18+
permissions:
19+
contents: read
20+
issues: write
21+
with:
22+
target_repository: ${{ github.repository }}
23+
release_id: ${{ github.event.release.id }}
24+
configuration_source: central
25+
# Pin this SHA in SecondSkoll/generic-agentic-workflows-config.
26+
configuration_ref: 9b35f1fc2860a1d6b8f1abaa9b467dc4eb42aec8
27+
configuration_profile: release-project-review
28+
validate_only: true
29+
secrets:
30+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
31+
central_config_token: ${{ secrets.central_config_token }}

‎docs/examples/configuration-sources/central/.github/workflows/release-project-review.yml‎

Lines changed: 0 additions & 74 deletions
This file was deleted.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: External release project review (supplied default configuration)
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
workflow_dispatch:
7+
inputs:
8+
target_repository:
9+
description: Canonical owner/repository of the external release to review
10+
type: string
11+
required: true
12+
release_id:
13+
description: Optional positive release ID; defaults to the target's latest release
14+
type: string
15+
required: false
16+
default: ''
17+
18+
permissions:
19+
contents: read
20+
issues: write
21+
22+
jobs:
23+
find-scheduled-release:
24+
name: Find target release published in the last 24 hours
25+
if: github.event_name == 'schedule'
26+
runs-on: ubuntu-latest
27+
outputs:
28+
release_id: ${{ steps.find-release.outputs.release_id }}
29+
env:
30+
# Replace this placeholder with the canonical target owner/repository.
31+
TARGET_REPOSITORY: OWNER/REPOSITORY
32+
GH_TOKEN: ${{ secrets.release_target_token }}
33+
steps:
34+
- id: find-release
35+
name: Select most recent published release
36+
run: |
37+
set -euo pipefail
38+
gh api "/repos/$TARGET_REPOSITORY/releases?per_page=100" > releases.json
39+
release_id=$(python3 - <<'PY'
40+
import datetime as dt
41+
import json
42+
43+
now = dt.datetime.now(dt.timezone.utc)
44+
cutoff = now - dt.timedelta(hours=24)
45+
releases = json.load(open("releases.json", encoding="utf-8"))
46+
recent = []
47+
for release in releases:
48+
published_at = release.get("published_at")
49+
if release.get("draft") or not isinstance(published_at, str):
50+
continue
51+
published = dt.datetime.fromisoformat(published_at.replace("Z", "+00:00"))
52+
if cutoff <= published <= now:
53+
recent.append((published, release["id"]))
54+
print(max(recent, default=(None, ""))[1])
55+
PY
56+
)
57+
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
58+
59+
find-dispatch-release:
60+
name: Find latest target release for dispatch
61+
if: github.event_name == 'workflow_dispatch' && inputs.release_id == ''
62+
runs-on: ubuntu-latest
63+
outputs:
64+
release_id: ${{ steps.find-release.outputs.release_id }}
65+
env:
66+
TARGET_REPOSITORY: ${{ inputs.target_repository }}
67+
GH_TOKEN: ${{ secrets.release_target_token }}
68+
steps:
69+
- id: find-release
70+
name: Select latest published release
71+
run: |
72+
set -euo pipefail
73+
release_id=$(gh api "/repos/$TARGET_REPOSITORY/releases/latest" --jq '.id')
74+
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
75+
76+
release-review:
77+
if: >-
78+
always() && (inputs.release_id != '' ||
79+
needs.find-dispatch-release.outputs.release_id != '' ||
80+
needs.find-scheduled-release.outputs.release_id != ''
81+
)
82+
needs: [find-scheduled-release, find-dispatch-release]
83+
uses: SecondSkoll/generic-agentic-workflows/.github/workflows/opencode-release-project-review.yml@61ed1bbd34a878f3ae270b1e4ff027cf786b730b
84+
permissions:
85+
contents: read
86+
issues: write
87+
with:
88+
target_repository: ${{ inputs.target_repository || 'OWNER/REPOSITORY' }}
89+
release_id: ${{ inputs.release_id || needs.find-dispatch-release.outputs.release_id || needs.find-scheduled-release.outputs.release_id }}
90+
configuration_source: default
91+
configuration_ref: 61ed1bbd34a878f3ae270b1e4ff027cf786b730b
92+
configuration_profile: release-project-review
93+
validate_only: true
94+
secrets:
95+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
96+
release_target_token: ${{ secrets.release_target_token }}
97+
central_config_token: ${{ secrets.central_config_token }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release project review (self, supplied default configuration)
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
issues: write
10+
11+
jobs:
12+
release-review:
13+
# The pin below must point to a reviewed release commit that contains both
14+
# the reusable workflow and the supplied release-project-review profile.
15+
# The placeholder SHA shown predates the release project-review work and is
16+
# a format placeholder only; replace it before enabling this workflow.
17+
uses: SecondSkoll/generic-agentic-workflows/.github/workflows/opencode-release-project-review.yml@61ed1bbd34a878f3ae270b1e4ff027cf786b730b
18+
permissions:
19+
contents: read
20+
issues: write
21+
with:
22+
target_repository: ${{ github.repository }}
23+
release_id: ${{ github.event.release.id }}
24+
configuration_source: default
25+
# configuration_ref must be the same reviewed commit SHA as `uses:` above.
26+
configuration_ref: 61ed1bbd34a878f3ae270b1e4ff027cf786b730b
27+
configuration_profile: release-project-review
28+
validate_only: true
29+
secrets:
30+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
31+
central_config_token: ${{ secrets.central_config_token }}

0 commit comments

Comments
 (0)