Skip to content

Commit 41cb076

Browse files
committed
Creat issue when release failed
1 parent 672026c commit 41cb076

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/deploy-doc.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,24 @@ jobs:
3737
with:
3838
path: docs/.vitepress/dist
3939

40+
- name: Create GitHub Issue on Failure
41+
if: failure()
42+
uses: actions/github-script@v7
43+
with:
44+
script: |
45+
const { owner, repo } = context.repo;
46+
const issueTitle = `build-page job failed`;
47+
const issueBody = `The build-page job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
48+
const assignees = [context.actor];
49+
50+
await github.rest.issues.create({
51+
owner,
52+
repo,
53+
title: issueTitle,
54+
body: issueBody,
55+
assignees
56+
});
57+
4058
deploy:
4159
environment:
4260
name: github-pages
@@ -48,3 +66,21 @@ jobs:
4866
- name: Deploy to GitHub Pages
4967
id: deployment
5068
uses: actions/deploy-pages@v4
69+
70+
- name: Create GitHub Issue on Failure
71+
if: failure()
72+
uses: actions/github-script@v7
73+
with:
74+
script: |
75+
const { owner, repo } = context.repo;
76+
const issueTitle = `deploy-page job failed`;
77+
const issueBody = `The deploy-page job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
78+
const assignees = [context.actor];
79+
80+
await github.rest.issues.create({
81+
owner,
82+
repo,
83+
title: issueTitle,
84+
body: issueBody,
85+
assignees
86+
});

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,31 @@ jobs:
2727
VERSION=${{ github.event.release.tag_name }}
2828
fi
2929
VERSION=${VERSION#v}
30+
echo "VERSION=$VERSION" >> $GITHUB_ENV
3031
node ./scripts/update-version.mjs $VERSION
3132
- run: npm run release
3233
env:
3334
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN_2 }}
3435

36+
- name: Create GitHub Issue on Failure
37+
if: failure()
38+
uses: actions/github-script@v7
39+
with:
40+
script: |
41+
const { owner, repo } = context.repo;
42+
const version = process.env.VERSION;
43+
const issueTitle = `Release job for ${version} failed`;
44+
const issueBody = `The release job failed. Please check the [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for more details.`;
45+
const assignees = [context.actor];
46+
47+
await github.rest.issues.create({
48+
owner,
49+
repo,
50+
title: issueTitle,
51+
body: issueBody,
52+
assignees
53+
});
54+
3555
deploy-docs:
3656
needs: [release-package]
3757
uses: ./.github/workflows/deploy-doc.yml

0 commit comments

Comments
 (0)