mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-11-30 02:08:12 +08:00
ci: refactor pr preview alert (#4781)
This commit is contained in:
parent
72d264de03
commit
21d41aed87
42
.github/workflows/preview-deploy.yml
vendored
42
.github/workflows/preview-deploy.yml
vendored
@ -42,20 +42,25 @@ jobs:
|
||||
|
||||
- name: Deploy has succeeded
|
||||
if: ${{ success() }}
|
||||
run: |
|
||||
export DEPLOY_DOMAIN=https://preview-${PULL_REQUEST_NUMBER}-element-plus.surge.sh
|
||||
curl -X POST ${BOT_URL} -H 'Content-Type:application/json' --data-raw '{"botAction":"Preview", "pr":'${PULL_REQUEST_NUMBER}', "url":"'${DEPLOY_DOMAIN}'"}'
|
||||
env:
|
||||
BOT_URL: ${{ secrets.BOT_URL }}
|
||||
PULL_REQUEST_NUMBER: ${{ steps.pr.outputs.id }}
|
||||
uses: actions-cool/maintain-one-comment@v1.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
[<img width="400" src="https://user-images.githubusercontent.com/10731096/103995277-368b9a00-51d3-11eb-9f8f-67542f560613.png">](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh)
|
||||
<!-- ELEMENT_PLUS_PREVIEW -->
|
||||
body-include: '<!-- ELEMENT_PLUS_PREVIEW -->'
|
||||
number: ${{ steps.pr.outputs.id }}
|
||||
|
||||
- name: Deploy has failed
|
||||
if: ${{ failure() }}
|
||||
run: |
|
||||
curl -X POST ${BOT_URL} -H 'Content-Type:application/json' --data-raw '{"status":"error", "botAction":"Preview", "pr":'${PULL_REQUEST_NUMBER}'}'
|
||||
env:
|
||||
BOT_URL: ${{ secrets.BOT_URL }}
|
||||
PULL_REQUEST_NUMBER: ${{ steps.pr.outputs.id }}
|
||||
uses: actions-cool/maintain-one-comment@v1.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
[<img width="400" src="https://user-images.githubusercontent.com/10731096/103995139-004e1a80-51d3-11eb-99ba-57e4b04826b4.png">](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh)
|
||||
<!-- ELEMENT_PLUS_PREVIEW -->
|
||||
body-include: '<!-- ELEMENT_PLUS_PREVIEW -->'
|
||||
number: ${{ steps.pr.outputs.id }}
|
||||
|
||||
# Build failed, update comment
|
||||
on-failure:
|
||||
@ -74,9 +79,12 @@ jobs:
|
||||
id: pr
|
||||
run: echo "::set-output name=id::$(<pr.txt)"
|
||||
|
||||
- name: Update comment
|
||||
run: |
|
||||
curl -X POST ${BOT_URL} -H 'Content-Type:application/json' --data-raw '{"status":"error", "botAction":"Preview", "pr":'${PULL_REQUEST_NUMBER}'}'
|
||||
env:
|
||||
BOT_URL: ${{ secrets.BOT_URL }}
|
||||
PULL_REQUEST_NUMBER: ${{ steps.pr.outputs.id }}
|
||||
- name: Deploy has failed
|
||||
uses: actions-cool/maintain-one-comment@v1.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
[<img width="400" src="https://user-images.githubusercontent.com/10731096/103995139-004e1a80-51d3-11eb-99ba-57e4b04826b4.png">](https://preview-${{ steps.pr.outputs.id }}-element-plus.surge.sh)
|
||||
<!-- ELEMENT_PLUS_PREVIEW -->
|
||||
body-include: '<!-- ELEMENT_PLUS_PREVIEW -->'
|
||||
number: ${{ steps.pr.outputs.id }}
|
||||
|
16
.github/workflows/preview-start.yml
vendored
Normal file
16
.github/workflows/preview-start.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
name: Preview Start
|
||||
|
||||
on: pull_request_target
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: create
|
||||
uses: actions-cool/maintain-one-comment@v1.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
<img width="400" src="https://user-images.githubusercontent.com/17680888/145600226-14f9cb31-33b8-4757-b2c0-affdb7499089.png">
|
||||
<!-- ELEMENT_PLUS_PREVIEW -->
|
||||
body-include: '<!-- ELEMENT_PLUS_PREVIEW -->'
|
Loading…
Reference in New Issue
Block a user