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

Function BenchmarkWriteJavaScriptToYAML

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

Source from the content-addressed store, hash-verified

321}
322
323func BenchmarkWriteJavaScriptToYAML(b *testing.B) {
324 script := `const github = require('@actions/github');
325const core = require('@actions/core');
326
327const token = process.env.GITHUB_TOKEN;
328const context = github.context;
329
330if (!token) {
331 core.setFailed('GITHUB_TOKEN is required');
332 return;
333}
334
335const octokit = github.getOctokit(token);
336
337// Create a pull request
338const result = await octokit.rest.pulls.create({
339 owner: context.repo.owner,
340 repo: context.repo.repo,
341 title: 'Automated PR',
342 head: 'feature-branch',
343 base: 'main',
344 body: 'This is an automated pull request'
345});
346
347console.log('PR created:', result.data.html_url);`
348
349 for b.Loop() {
350 var yaml strings.Builder
351 WriteJavaScriptToYAML(&yaml, script)
352 }
353}

Callers

nothing calls this directly

Calls 1

WriteJavaScriptToYAMLFunction · 0.85

Tested by

no test coverage detected