This is an automated email from the ASF dual-hosted git repository.

ricardozanini pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-docs.git


The following commit(s) were added to refs/heads/main by this push:
     new d6eda9f25 NO-ISSUE - Try to fix PR id not found in github event (#566)
d6eda9f25 is described below

commit d6eda9f259d7559624f684fe1157e582db9c95c1
Author: Ricardo Zanini <[email protected]>
AuthorDate: Thu Mar 7 16:38:07 2024 -0300

    NO-ISSUE - Try to fix PR id not found in github event (#566)
    
    Signed-off-by: Ricardo Zanini <[email protected]>
---
 .github/workflows/pr-preview-publish.yml | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pr-preview-publish.yml 
b/.github/workflows/pr-preview-publish.yml
index 45dc4b168..d6d7127c2 100644
--- a/.github/workflows/pr-preview-publish.yml
+++ b/.github/workflows/pr-preview-publish.yml
@@ -31,6 +31,14 @@ jobs:
     if: github.event.workflow_run.event == 'pull_request' && 
github.event.workflow_run.conclusion == 'success'
     runs-on: ubuntu-latest
     steps:
+      - name: Get PR number
+        id: get_pr_number
+        run: |
+          PR_URL=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN 
}}" ${{ github.event.workflow_run.url }}/pull_requests | jq -r 
'.pull_requests[0].url')
+          PR_NUMBER=$(basename $PR_URL)
+          echo "PR number: $PR_NUMBER"
+        shell: bash
+
       - name: Download PR Artifact
         uses: actions/download-artifact@v4
         with:
@@ -41,7 +49,7 @@ jobs:
 
       - name: Publish to Surge for preview
         id: deploy
-        run: npx surge ./build/site --domain 
https://sonataflow-docs-preview-pr-${{ 
github.event.workflow_run.pull_requests[0].number }}.surge.sh --token ${{ 
secrets.SURGE_LOCAL_TOKEN }}
+        run: npx surge ./build/site --domain 
https://sonataflow-docs-preview-pr-${{ env.PR_NUMBER }}.surge.sh --token ${{ 
secrets.SURGE_LOCAL_TOKEN }}
 
       - name: Update PR status comment on success
         if: success()
@@ -49,10 +57,10 @@ jobs:
         with:
           token: ${{ secrets.GITHUB_TOKEN }}
           body: |
-            🎊 PR Preview ${{ github.sha }} has been successfully built and 
deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{ 
github.event.workflow_run.pull_requests[0].number }}.surge.sh
+            🎊 PR Preview ${{ github.sha }} has been successfully built and 
deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{ 
env.PR_NUMBER }}.surge.sh
             <!-- Sticky Pull Request Comment -->
           body-include: "<!-- Sticky Pull Request Comment -->"
-          number: ${{ github.event.workflow_run.pull_requests[0].number }}
+          number: ${{ env.PR_NUMBER }}
           emojis: "heart"
 
       - name: Update PR status comment on failure
@@ -65,5 +73,5 @@ jobs:
             <img width="300" 
src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png";>
             <!-- Sticky Pull Request Comment -->
           body-include: "<!-- Sticky Pull Request Comment -->"
-          number: ${{ github.event.workflow_run.pull_requests[0].number }}
+          number: ${{ env.PR_NUMBER }}
           emojis: "confused"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to