Skip to content

Commit d183652

Browse files
chore: Link OpenAPI docs sync to correct PR (#19067)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
1 parent a1504cf commit d183652

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.github/workflows/sync-public-api-docs.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,28 @@ jobs:
8282
echo "Copying 'packages/cli/dist/public-api/v1/openapi.yml' to '${DOCS_TARGET_PATH}'"
8383
cp packages/cli/dist/public-api/v1/openapi.yml "${DOCS_TARGET_PATH}"
8484
85+
- name: Extract PR number from commit message
86+
if: steps.verify_file.outputs.file_exists == 'true'
87+
id: extract_pr
88+
run: |
89+
COMMIT_MESSAGE=$(git log -1 --pretty=%s)
90+
echo "Commit message: $COMMIT_MESSAGE"
91+
92+
# Extract PR number from commit message (format: "title (#1234)")
93+
PR_NUMBER=$(echo "$COMMIT_MESSAGE" | grep -om1E '\(#[0-9]+\)' | grep -oE '[0-9]+' || echo "")
94+
95+
if [ -n "$PR_NUMBER" ]; then
96+
echo "Found PR number: $PR_NUMBER"
97+
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
98+
echo "pr_url=https://github.com/${{ github.repository }}/pull/$PR_NUMBER" >> "$GITHUB_OUTPUT"
99+
echo "source_link=Source PR: [$PR_NUMBER](https://github.com/${{ github.repository }}/pull/$PR_NUMBER)" >> "$GITHUB_OUTPUT"
100+
else
101+
echo "No PR number found in commit message, using commit link"
102+
echo "pr_number=" >> "$GITHUB_OUTPUT"
103+
echo "pr_url=" >> "$GITHUB_OUTPUT"
104+
echo "source_link=Source commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> "$GITHUB_OUTPUT"
105+
fi
106+
85107
- name: Create PR in Docs Repo
86108
if: steps.verify_file.outputs.file_exists == 'true'
87109

@@ -105,6 +127,6 @@ jobs:
105127
Automated update of the Public API OpenAPI YAML schema.
106128
107129
This PR was generated by a GitHub Action in the [${{ github.repository }} repository](https://github.com/${{ github.repository }}).
108-
Source commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
130+
${{ steps.extract_pr.outputs.source_link }}
109131
110132
Please review the changes and merge if appropriate.

0 commit comments

Comments
 (0)