Skip to content

Commit

Permalink
ci(github): add PR preview url update job in preview workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Nov 24, 2022
1 parent 62682fb commit 94bf3bd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Related Issues

- Resolve MTES-MCT/monitorenv#1
- Resolve MTES-MCT/monitorfish#1

## Preview URL

_Waiting for deployment..._<!-- AUTOFILLED_PREVIEW_URL -->
15 changes: 15 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: pull_request
jobs:
publish:
runs-on: ubuntu-latest
outputs:
# https://www.chromatic.com/docs/github-actions#outputs
storybookUrl: ${{ steps.publish.outputs.storybookUrl }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -18,8 +21,20 @@ jobs:
- name: Install
run: yarn
- name: Publish
id: publish
uses: chromaui/action@v1
with:
buildScriptName: preview
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
token: ${{ secrets.GH_PAT }}

update_pull_request:
runs-on: ubuntu-latest
needs: publish
steps:
- name: Update Pull Request Preview URL
uses: ivangabriele/find-and-replace-pull-request-body@dev
with:
githubToken: ${{ secrets.GH_PAT }}
find: "_Waiting for deployment..._<!-- AUTOFILLED_PREVIEW_URL -->"
replace: ${{ needs.publish.outputs.storybookUrl }}

0 comments on commit 94bf3bd

Please sign in to comment.