Skip to content

Commit 0c74fad

Browse files
authored
On branch edburns/ghcp-sp-122-java-release-improvements (#1512)
* On branch edburns/ghcp-sp-122-java-release-improvements modified: .github/aw/actions-lock.json modified: .github/workflows/java.notes.template modified: .github/workflows/release-changelog.lock.yml modified: .github/workflows/release-changelog.md Try to fix the 📦 [View on Maven Central]((central.sonatype.com/redacted) problem. * fix: recompile release-changelog workflow with gh-aw v0.74.4 to match CI * On branch edburns/ghcp-sp-122-java-release-improvements modified: .github/workflows/java-publish-maven.yml - Add a preflight to try to avoid failures.
1 parent c0dbe9a commit 0c74fad

3 files changed

Lines changed: 38 additions & 4 deletions

File tree

.github/workflows/java-publish-maven.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,36 @@ concurrency:
3232
cancel-in-progress: false
3333

3434
jobs:
35+
preflight:
36+
name: Preflight checks
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Verify GITHUB_TOKEN can create releases
40+
run: |
41+
# Test that the token has contents:write by checking repo permissions
42+
PERMS=$(gh api repos/${{ github.repository }} --jq '.permissions.push // false')
43+
if [ "$PERMS" != "true" ]; then
44+
echo "::error::GITHUB_TOKEN lacks push/write permission on this repository. GitHub Release creation will fail."
45+
exit 1
46+
fi
47+
echo "GITHUB_TOKEN permissions OK"
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Verify JAVA_RELEASE_GITHUB_TOKEN is valid
52+
run: |
53+
# Test that the token can authenticate and trigger workflows
54+
USER=$(gh api user --jq '.login' 2>&1) || {
55+
echo "::error::JAVA_RELEASE_GITHUB_TOKEN is invalid or expired. Changelog trigger will fail."
56+
exit 1
57+
}
58+
echo "JAVA_RELEASE_GITHUB_TOKEN is valid (authenticated as: ${USER})"
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.JAVA_RELEASE_GITHUB_TOKEN }}
61+
3562
publish-maven:
3663
name: Publish Java SDK to Maven Central
64+
needs: preflight
3765
runs-on: ubuntu-latest
3866
defaults:
3967
run:
@@ -177,7 +205,7 @@ jobs:
177205
178206
github-release:
179207
name: Create GitHub Release
180-
needs: publish-maven
208+
needs: [preflight, publish-maven]
181209
if: github.ref == 'refs/heads/main'
182210
runs-on: ubuntu-latest
183211
defaults:

.github/workflows/java.notes.template

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
<!-- INSTALLATION_SECTION: preserve this section verbatim when updating release notes -->
2+
<!-- maven_central_url: https://central.sonatype.com/artifact/${GROUP_ID}/${ARTIFACT_ID}/${VERSION} -->
13
# Installation
24

3-
ℹ️ **Public Preview:** This is the official Java SDK for GitHub Copilot. This repository treats the official .NET and Node.js SDKs for GitHub Copilot as reference implementations. These SDKs are all officially supported as GitHub open source projects. The Java implementation follows the backward compatibility guarantees offered by the reference implementations.
4-
55
⚠️ **Artifact versioning plan:** Releases of this implementation track releases of the reference implementation. For each release of the reference implementation, there may follow a corresponding release of this implementation with the same number as the reference implementation. Release identifiers of the reference implementation are in the form `vMaj.Min.Micro`. For example v0.1.32. The corresponding maven version for the release will be `Maj.Min.Micro-java.N`, where `Maj`, `Min` and `Micro` are the corresponding numbers for the reference implementation release, and `N` is a monotonically increasing sequence number starting with 0 for each release. See the corresponding architectural decision record for more information in the `docs/adr` directory of the source code.
6-
6+
77
📦 [View on Maven Central](https://central.sonatype.com/artifact/${GROUP_ID}/${ARTIFACT_ID}/${VERSION})
8+
<!-- END_INSTALLATION_SECTION -->
89

910
## Maven
1011
```xml

.github/workflows/release-changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ Use the `create-pull-request` output to submit your changes. The PR should:
117117

118118
Use the `update-release` output to replace the auto-generated release notes with your nicely formatted changelog. **Do not include the version heading** (`## [vX.Y.Z](...) (date)`) in the release notes — the release already has a title showing the version. Start directly with the feature sections or other changes list.
119119

120+
**IMPORTANT — Preserving the Installation section:**
121+
The release body may contain an Installation section delimited by `<!-- INSTALLATION_SECTION -->` and `<!-- END_INSTALLATION_SECTION -->` HTML comments. In the case of Java, this section includes Maven/Gradle dependency snippets and a "View on Maven Central" link. You **MUST** preserve this entire section (from the opening comment through the closing comment, inclusive) exactly as it appears in the existing release body. Place your generated changelog content **after** the Installation section.
122+
123+
**URL reconstruction:** If the Maven Central URL in the Installation section appears corrupted or contains the word "redacted", reconstruct it. Extract the version from the release tag (e.g., `java/v1.0.0``1.0.0`), and rebuild the URL as: `https://central.sonatype.com/artifact/com.github/copilot-sdk-java/{VERSION}`. The `<!-- maven_central_url -->` HTML comment in the section contains the intended URL pattern.
124+
120125
## Example Output
121126

122127
Here is an example of what a changelog entry should look like, based on real commits from this repo. **Follow this style exactly.**

0 commit comments

Comments
 (0)