-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (38 loc) · 1.24 KB
/
vercel-build-comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Vercel Build Comment
on:
pull_request:
types: [opened, synchronize]
jobs:
comment-on-failure:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Wait for Vercel build
uses: patrickedqvist/[email protected]
id: waitForVercel
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 300
check_interval: 10
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
- name: Comment PR on failure
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
try {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body: 'The Vercel build for this PR has failed. Please check the Vercel deployment logs for more information.'
});
} catch (error) {
console.error('Error posting comment:', error);
core.setFailed(`Failed to post comment: ${error.message}`);
}