buildAutoUpdateWorkflowYAML generates the YAML content for agentic-auto-upgrade.yml.
( cronSchedule, setupActionRef, githubScriptPin, installCLISteps, cliCmdPrefix string, )
| 134 | |
| 135 | // buildAutoUpdateWorkflowYAML generates the YAML content for agentic-auto-upgrade.yml. |
| 136 | func buildAutoUpdateWorkflowYAML( |
| 137 | cronSchedule, setupActionRef, githubScriptPin, installCLISteps, cliCmdPrefix string, |
| 138 | ) string { |
| 139 | customInstructions := `Alternative regeneration methods: |
| 140 | make recompile |
| 141 | |
| 142 | Or use the gh-aw CLI directly: |
| 143 | ./gh-aw compile --validate --verbose |
| 144 | |
| 145 | The workflow is generated when auto_upgrade is set to true in aw.json. |
| 146 | The 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 | |
| 152 | on: |
| 153 | schedule: |
| 154 | - cron: "` + cronSchedule + `" # Weekly (auto-upgrade) |
| 155 | workflow_dispatch: |
| 156 | |
| 157 | permissions: |
| 158 | contents: read |
| 159 | issues: write |
| 160 | |
| 161 | jobs: |
| 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 | } |
no test coverage detected