|
88 | 88 | "| \($r.metric) | \($r.mean)\($r.unit) | \($r.median)\($r.unit) | \($r.p95)\($r.unit) | \($r.p99)\($r.unit) | \($t.target // "N/A")\(if $t then $r.unit else "" end) | \($t.critical // "N/A")\(if $t then $r.unit else "" end) |"' \ |
89 | 89 | benchmark-results.json >> "$GITHUB_STEP_SUMMARY" |
90 | 90 |
|
| 91 | + - name: Ensure labels exist |
| 92 | + if: steps.check.outputs.regression_count != '0' |
| 93 | + uses: actions/github-script@v7 |
| 94 | + with: |
| 95 | + script: | |
| 96 | + const labels = [ |
| 97 | + { name: 'needs-investigation', color: 'e4e669', description: 'Requires further investigation' }, |
| 98 | + { name: 'performance', color: 'd4c5f9', description: 'Performance related' }, |
| 99 | + ]; |
| 100 | + for (const label of labels) { |
| 101 | + try { |
| 102 | + await github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, ...label }); |
| 103 | + core.info(`Created label: ${label.name}`); |
| 104 | + } catch (e) { |
| 105 | + if (e.status === 422) { |
| 106 | + core.info(`Label already exists: ${label.name}`); |
| 107 | + } else { |
| 108 | + throw e; |
| 109 | + } |
| 110 | + } |
| 111 | + } |
| 112 | +
|
91 | 113 | - name: Create regression issue |
92 | 114 | if: steps.check.outputs.regression_count != '0' |
93 | 115 | uses: actions/github-script@v7 |
@@ -123,10 +145,15 @@ jobs: |
123 | 145 | `</details>`, |
124 | 146 | ].join('\n'); |
125 | 147 |
|
126 | | - await github.rest.issues.create({ |
127 | | - owner: context.repo.owner, |
128 | | - repo: context.repo.repo, |
129 | | - title: `Performance regression detected (${new Date().toISOString().split('T')[0]})`, |
130 | | - body, |
131 | | - labels: ['performance', 'needs-investigation'], |
132 | | - }); |
| 148 | + try { |
| 149 | + const issue = await github.rest.issues.create({ |
| 150 | + owner: context.repo.owner, |
| 151 | + repo: context.repo.repo, |
| 152 | + title: `Performance regression detected (${new Date().toISOString().split('T')[0]})`, |
| 153 | + body, |
| 154 | + labels: ['performance', 'needs-investigation'], |
| 155 | + }); |
| 156 | + core.info(`Created regression issue: ${issue.data.html_url}`); |
| 157 | + } catch (error) { |
| 158 | + core.setFailed(`Failed to create regression issue: ${error.message}`); |
| 159 | + } |
0 commit comments