diff --git a/.github/workflows/sync-public-api-docs.yml b/.github/workflows/sync-public-api-docs.yml index 304c585faf179..1119e4c0eb66a 100644 --- a/.github/workflows/sync-public-api-docs.yml +++ b/.github/workflows/sync-public-api-docs.yml @@ -82,6 +82,28 @@ jobs: echo "Copying 'packages/cli/dist/public-api/v1/openapi.yml' to '${DOCS_TARGET_PATH}'" cp packages/cli/dist/public-api/v1/openapi.yml "${DOCS_TARGET_PATH}" + - name: Extract PR number from commit message + if: steps.verify_file.outputs.file_exists == 'true' + id: extract_pr + run: | + COMMIT_MESSAGE=$(git log -1 --pretty=%s) + echo "Commit message: $COMMIT_MESSAGE" + + # Extract PR number from commit message (format: "title (#1234)") + PR_NUMBER=$(echo "$COMMIT_MESSAGE" | grep -om1E '\(#[0-9]+\)' | grep -oE '[0-9]+' || echo "") + + if [ -n "$PR_NUMBER" ]; then + echo "Found PR number: $PR_NUMBER" + echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT" + echo "pr_url=https://github.com/${{ github.repository }}/pull/$PR_NUMBER" >> "$GITHUB_OUTPUT" + echo "source_link=Source PR: [$PR_NUMBER](https://github.com/${{ github.repository }}/pull/$PR_NUMBER)" >> "$GITHUB_OUTPUT" + else + echo "No PR number found in commit message, using commit link" + echo "pr_number=" >> "$GITHUB_OUTPUT" + echo "pr_url=" >> "$GITHUB_OUTPUT" + echo "source_link=Source commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> "$GITHUB_OUTPUT" + fi + - name: Create PR in Docs Repo if: steps.verify_file.outputs.file_exists == 'true' @@ -105,6 +127,6 @@ jobs: Automated update of the Public API OpenAPI YAML schema. This PR was generated by a GitHub Action in the [${{ github.repository }} repository](https://github.com/${{ github.repository }}). - Source commit: [${{ github.sha }}](https://github.com/${{ github.repository }}/commit/${{ github.sha }}) + ${{ steps.extract_pr.outputs.source_link }} Please review the changes and merge if appropriate.