(b *testing.B)
| 290 | } |
| 291 | |
| 292 | func BenchmarkFormatJavaScriptForYAML(b *testing.B) { |
| 293 | script := `const github = require('@actions/github'); |
| 294 | const core = require('@actions/core'); |
| 295 | |
| 296 | const token = process.env.GITHUB_TOKEN; |
| 297 | const context = github.context; |
| 298 | |
| 299 | if (!token) { |
| 300 | core.setFailed('GITHUB_TOKEN is required'); |
| 301 | return; |
| 302 | } |
| 303 | |
| 304 | const octokit = github.getOctokit(token); |
| 305 | |
| 306 | // Create a pull request |
| 307 | const result = await octokit.rest.pulls.create({ |
| 308 | owner: context.repo.owner, |
| 309 | repo: context.repo.repo, |
| 310 | title: 'Automated PR', |
| 311 | head: 'feature-branch', |
| 312 | base: 'main', |
| 313 | body: 'This is an automated pull request' |
| 314 | }); |
| 315 | |
| 316 | console.log('PR created:', result.data.html_url);` |
| 317 | |
| 318 | for b.Loop() { |
| 319 | FormatJavaScriptForYAML(script) |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | func BenchmarkWriteJavaScriptToYAML(b *testing.B) { |
| 324 | script := `const github = require('@actions/github'); |
nothing calls this directly
no test coverage detected