Skip to content

Commit

Permalink
chore: create issue when monitor failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Nov 23, 2023
1 parent 1d2fdb9 commit 659ec7d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/monitor-metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
monitor:
continue-on-error: true
strategy:
matrix:
include:
Expand Down Expand Up @@ -37,6 +38,7 @@ jobs:
run: cd scripts && pnpm run build

- name: Monitor Metrics
id: monitor
run: |
result=$(cd scripts && MONITOR=1 node ./dist/compare.js ${{ matrix.product }})
echo "$result"
Expand All @@ -45,3 +47,39 @@ jobs:
echo "Some benchmark metrics exceed the threshold, please visit the previous step for more information"
exit 1
fi
- name: Create Issue on Failure
if: failure()
uses: actions/github-script@v6
with:
github-token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
script: |
const diffResult = `${{ needs.monitor.outputs.diff-result }}`
let result = "task ${{ needs.run-bench.result }}"
if (diffResult) {
result = diffResult.replace(/@@/g, "\n");
}
const url = `${context.serverUrl}//${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/job/${context.jobId}`
const urlLink = `[Open](${url})`
const issueTitle = `Benchmark Performance Degradation`
const issueBody = `
📝 Benchmark detail: ${urlLink}
${result}
`
let repo = context.repo.repo
const product = "${{ matrix.product }}"
if (product === "MODERNJS_FRAMEWORK" || product === "MODERNJS_MODULE") {
repo = "modern.js"
} else if (product === "RSBUILD") {
repo = "rsbuild"
} else if (product === "RSPRESS") {
repo = "rspress"
}
await github.rest.issues.create({
owner: context.repo.owner,
repo: repo,
title: issueTitle,
body: issueBody,
});

0 comments on commit 659ec7d

Please sign in to comment.