Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/ci/actions/createOrUpdatePR.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func GeneratePRFromReports(inputDir string) (*prdescription.Output, *versioning.
LintingReportURL: lintingReportURL,
ChangesReportURL: changesReportURL,
ManualBump: manualBump,
ActionRunURL: environment.GetActionRunURL(environment.GetRepo()),

@2ynn 2ynn Apr 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NB: this ActionRunURL is only used for the fanout flow (multiple targets with merged report files in combined PR description). In this case no speakeasy ci pr-description command is involved.

🆚 Standard CI pr-description flow: single-pass generation. The ActionrunURL is built in the action and the full prdescription.Input is piped it as JSON to speakeasy ci pr-description --input

}

output, err := prdescription.Generate(input)
Expand Down
9 changes: 9 additions & 0 deletions internal/ci/environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ func GetGithubServerURL() string {
return os.Getenv("GITHUB_SERVER_URL")
}

func GetActionRunURL(repo string) string {
serverURL := os.Getenv("GITHUB_SERVER_URL")
runID := os.Getenv("GITHUB_RUN_ID")
if serverURL == "" || repo == "" || runID == "" {
return ""
}
return fmt.Sprintf("%s/%s/actions/runs/%s", serverURL, repo, runID)
}

func GetGithubOIDCRequestURL() string {
return os.Getenv("ACTIONS_ID_TOKEN_REQUEST_URL")
}
Expand Down
5 changes: 3 additions & 2 deletions internal/ci/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ func EnrichEventWithEnvironmentVariables(event *shared.CliEvent) {
event.GhActionOrganization = &ghActionOrg
repo := strings.TrimPrefix(ghActionRepoOrg, ghActionOrg+"/")
event.GhActionRepository = &repo
runLink := fmt.Sprintf("%s/%s/actions/runs/%s", os.Getenv("GITHUB_SERVER_URL"), ghActionRepoOrg, os.Getenv("GITHUB_RUN_ID"))
event.GhActionRunLink = &runLink
if runLink := environment.GetActionRunURL(ghActionRepoOrg); runLink != "" {
event.GhActionRunLink = &runLink
}

ghActionVersion := os.Getenv("GH_ACTION_VERSION")
if ghActionVersion != "" {
Expand Down
22 changes: 19 additions & 3 deletions internal/prdescription/prdescription.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Input struct {
// Version information
SpeakeasyVersion string `json:"speakeasy_version,omitempty"`
ManualBump bool `json:"manual_bump,omitempty"`
ActionRunURL string `json:"action_run_url,omitempty"`

// Version report data (from SPEAKEASY_VERSION_REPORT_LOCATION)
VersionReport *versioning.MergedVersionReport `json:"version_report,omitempty"`
Expand Down Expand Up @@ -113,6 +114,16 @@ func buildBody(input Input) string {
versionMsg += fmt.Sprintf("\n\nThis PR will stay on the current version until the %s label is removed and/or modified.", bumpType)
} else {
versionMsg += "\U0001F916 (automated)" // 🤖
versionMsg += "\n\n> [!TIP]"
switch bumpType {
case versioning.BumpPrerelease:
versionMsg += "\n> To exit [pre-release versioning](https://www.speakeasy.com/docs/sdks/manage/versioning#pre-release-version-bumps), set a new version or run `speakeasy bump graduate`."
case versioning.BumpPatch, versioning.BumpMinor:
versionMsg += "\n> If updates to your OpenAPI document introduce breaking changes, be sure to update the `info.version` field to [trigger the correct version bump](https://www.speakeasy.com/docs/sdks/manage/versioning#openapi-document-changes)."
default:
}

versionMsg += "\n> Speakeasy supports manual control of SDK versioning through [multiple methods](https://www.speakeasy.com/docs/sdks/manage/versioning#manual-version-bumps)."
}
body.WriteString(versionMsg + "\n")
}
Expand All @@ -122,9 +133,14 @@ func buildBody(input Input) string {
body.WriteString(stripANSICodes(markdownSection))
}

// Footer with CLI version
if !input.SourceGeneration && input.SpeakeasyVersion != "" {
body.WriteString(fmt.Sprintf("\nBased on [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy) %s\n", input.SpeakeasyVersion))
// Footer
if !input.SourceGeneration {
if input.SpeakeasyVersion != "" {
body.WriteString(fmt.Sprintf("\nBased on [Speakeasy CLI](https://github.com/speakeasy-api/speakeasy) %s\n", input.SpeakeasyVersion))
}
if input.ActionRunURL != "" {
body.WriteString(fmt.Sprintf("\nLast updated by [Speakeasy workflow](%s)\n", input.ActionRunURL))
}
}

return body.String()
Expand Down
Loading