MCPcopy Create free account
hub / github.com/github/gh-aw / permissionsConfigToMap

Function permissionsConfigToMap

pkg/workflow/frontmatter_serialization.go:315–474  ·  view source on GitHub ↗

permissionsConfigToMap converts PermissionsConfig back to map[string]any

(config *PermissionsConfig)

Source from the content-addressed store, hash-verified

313
314// permissionsConfigToMap converts PermissionsConfig back to map[string]any
315func permissionsConfigToMap(config *PermissionsConfig) map[string]any {
316 if config == nil {
317 return nil
318 }
319
320 // If shorthand is set, return it directly
321 if config.Shorthand != "" {
322 frontmatterTypesLog.Printf("Converting PermissionsConfig to map via shorthand: %s", config.Shorthand)
323 return map[string]any{config.Shorthand: config.Shorthand}
324 }
325
326 frontmatterTypesLog.Print("Converting detailed PermissionsConfig to map")
327 result := make(map[string]any)
328
329 // GitHub Actions permission scopes
330 if config.Actions != "" {
331 result["actions"] = config.Actions
332 }
333 if config.Checks != "" {
334 result["checks"] = config.Checks
335 }
336 if config.Contents != "" {
337 result["contents"] = config.Contents
338 }
339 if config.Deployments != "" {
340 result["deployments"] = config.Deployments
341 }
342 if config.IDToken != "" {
343 result["id-token"] = config.IDToken
344 }
345 if config.Issues != "" {
346 result["issues"] = config.Issues
347 }
348 if config.Discussions != "" {
349 result["discussions"] = config.Discussions
350 }
351 if config.Packages != "" {
352 result["packages"] = config.Packages
353 }
354 if config.Pages != "" {
355 result["pages"] = config.Pages
356 }
357 if config.PullRequests != "" {
358 result["pull-requests"] = config.PullRequests
359 }
360 if config.RepositoryProjects != "" {
361 result["repository-projects"] = config.RepositoryProjects
362 }
363 if config.SecurityEvents != "" {
364 result["security-events"] = config.SecurityEvents
365 }
366 if config.Statuses != "" {
367 result["statuses"] = config.Statuses
368 }
369 if config.VulnerabilityAlerts != "" {
370 result["vulnerability-alerts"] = config.VulnerabilityAlerts
371 }
372 if config.OrganizationProjects != "" {

Callers 1

ToMapMethod · 0.85

Calls 2

PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected