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 734085123 NO-ISSUE - Use yet another alternative to grab PR ID (#569)
734085123 is described below
commit 734085123b4c9857dc487acd9db58b4f7d7158a3
Author: Ricardo Zanini <[email protected]>
AuthorDate: Fri Mar 8 15:12:41 2024 -0300
NO-ISSUE - Use yet another alternative to grab PR ID (#569)
NOISSUE - Use yet another alternative to grab PR ID
Signed-off-by: Ricardo Zanini <[email protected]>
---
.github/workflows/pr-preview-build.yml | 5 +++++
.github/workflows/pr-preview-publish.yml | 21 ++++++++++-----------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/pr-preview-build.yml
b/.github/workflows/pr-preview-build.yml
index 3434a3384..1c2a785ae 100644
--- a/.github/workflows/pr-preview-build.yml
+++ b/.github/workflows/pr-preview-build.yml
@@ -51,6 +51,11 @@ jobs:
- name: Install dependencies and build
run: npm run local-install-build
+ - name: Store PR id
+ if: github.event_name == 'pull_request'
+ run: |
+ echo ${{ github.event.number }} > ./build/site/pr-id.txt
+
- name: Publishing directory for PR preview
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
diff --git a/.github/workflows/pr-preview-publish.yml
b/.github/workflows/pr-preview-publish.yml
index d6d7127c2..4598c7139 100644
--- a/.github/workflows/pr-preview-publish.yml
+++ b/.github/workflows/pr-preview-publish.yml
@@ -31,13 +31,6 @@ 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
@@ -47,9 +40,15 @@ jobs:
run-id: ${{ github.event.workflow_run.id }}
path: ./build/site
+ - name: Store PR id as variable
+ id: pr
+ run: |
+ echo "id=$(<./build/site/pr-id.txt)" >> $GITHUB_OUTPUT
+ rm -f pr-id.txt
+
- name: Publish to Surge for preview
id: deploy
- run: npx surge ./build/site --domain
https://sonataflow-docs-preview-pr-${{ env.PR_NUMBER }}.surge.sh --token ${{
secrets.SURGE_LOCAL_TOKEN }}
+ run: npx surge ./build/site --domain
https://sonataflow-docs-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token
${{ secrets.SURGE_LOCAL_TOKEN }}
- name: Update PR status comment on success
if: success()
@@ -57,10 +56,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-${{
env.PR_NUMBER }}.surge.sh
+ 🎊 PR Preview ${{ github.sha }} has been successfully built and
deployed. See the documentation preview: https://sonataflow-docs-preview-pr-${{
steps.pr.outputs.id }}.surge.sh
<!-- Sticky Pull Request Comment -->
body-include: "<!-- Sticky Pull Request Comment -->"
- number: ${{ env.PR_NUMBER }}
+ number: ${{ steps.pr.outputs.id }}
emojis: "heart"
- name: Update PR status comment on failure
@@ -73,5 +72,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: ${{ env.PR_NUMBER }}
+ number: ${{ steps.pr.outputs.id }}
emojis: "confused"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]