MCPcopy Index your code
hub / github.com/github/gh-aw / BenchmarkFormatJavaScriptForYAML

Function BenchmarkFormatJavaScriptForYAML

pkg/workflow/js_test.go:292–321  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

290}
291
292func BenchmarkFormatJavaScriptForYAML(b *testing.B) {
293 script := `const github = require('@actions/github');
294const core = require('@actions/core');
295
296const token = process.env.GITHUB_TOKEN;
297const context = github.context;
298
299if (!token) {
300 core.setFailed('GITHUB_TOKEN is required');
301 return;
302}
303
304const octokit = github.getOctokit(token);
305
306// Create a pull request
307const 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
316console.log('PR created:', result.data.html_url);`
317
318 for b.Loop() {
319 FormatJavaScriptForYAML(script)
320 }
321}
322
323func BenchmarkWriteJavaScriptToYAML(b *testing.B) {
324 script := `const github = require('@actions/github');

Callers

nothing calls this directly

Calls 1

FormatJavaScriptForYAMLFunction · 0.85

Tested by

no test coverage detected