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

Function buildAutoUpdateWorkflowYAML

pkg/workflow/auto_update_workflow.go:136–187  ·  view source on GitHub ↗

buildAutoUpdateWorkflowYAML generates the YAML content for agentic-auto-upgrade.yml.

(
	cronSchedule, setupActionRef, githubScriptPin, installCLISteps, cliCmdPrefix string,
)

Source from the content-addressed store, hash-verified

134
135// buildAutoUpdateWorkflowYAML generates the YAML content for agentic-auto-upgrade.yml.
136func buildAutoUpdateWorkflowYAML(
137 cronSchedule, setupActionRef, githubScriptPin, installCLISteps, cliCmdPrefix string,
138) string {
139 customInstructions := `Alternative regeneration methods:
140 make recompile
141
142Or use the gh-aw CLI directly:
143 ./gh-aw compile --validate --verbose
144
145The workflow is generated when auto_upgrade is set to true in aw.json.
146The weekly schedule is deterministically scattered based on the repository slug.`
147
148 header := GenerateWorkflowHeader("", "pkg/workflow/auto_update_workflow.go", customInstructions)
149
150 return header + `name: Agentic Auto-Upgrade
151
152on:
153 schedule:
154 - cron: "` + cronSchedule + `" # Weekly (auto-upgrade)
155 workflow_dispatch:
156
157permissions:
158 contents: read
159 issues: write
160
161jobs:
162 auto-upgrade:
163 runs-on: ubuntu-latest
164 steps:
165 - name: Checkout repository
166 uses: ` + getActionPin("actions/checkout") + `
167
168` + installCLISteps + ` - name: Setup Scripts
169 uses: ` + setupActionRef + `
170 with:
171 destination: ${{ runner.temp }}/gh-aw/actions
172
173 - name: Run upgrade notification
174 uses: ` + githubScriptPin + `
175 env:
176 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177 GH_AW_OPERATION: upgrade
178 GH_AW_CMD_PREFIX: ` + cliCmdPrefix + `
179 with:
180 github-token: ${{ secrets.GITHUB_TOKEN }}
181 script: |
182 const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
183 setupGlobals(core, github, context, exec, io, getOctokit);
184 const { mainNotifyIssue } = require('${{ runner.temp }}/gh-aw/actions/run_operation_update_upgrade.cjs');
185 await mainNotifyIssue();
186`
187}

Callers 1

Calls 2

GenerateWorkflowHeaderFunction · 0.85
getActionPinFunction · 0.85

Tested by

no test coverage detected