GH-700: Author and Compile GitHub Agentic Workflows
To author and compile GitHub Agentic Workflows, translate the approved design into a Markdown file in .github/workflows/, configure its YAML frontmatter, write the agent instructions, and compile the source into a .lock.yml GitHub Actions workflow. Review and version both artifacts together. The Markdown expresses the intended task; the generated workflow is the executable configuration used by GitHub Actions.
This procedure uses official documentation checked on November 16, 2026. The complete weekly-report example is illustrative and has not been compiled or run here. The lock filename below is the expected output, not an inspected compiler result. Compilation checks configuration; it does not establish report accuracy or successful runtime authentication.
Establish the authoring prerequisites
Use a repository where you have write access and GitHub Actions is enabled. The documented setup requires an AI-engine account, authenticated GitHub CLI version 2.0.0 or later, and the github/gh-aw CLI extension. Check the CLI with gh --version. The installation command is gh extension install github/gh-aw.
For first-time coding-agent authoring, run gh aw init in the repository. It adds authoring skills, instructions and a custom agent. Ask the coding agent to use the agentic-workflows skill, supplying the approved design and output constraints. Manual Markdown authoring is also supported.
Choose authentication before treating the workflow as runnable. For the Copilot engine in an organization-owned repository with a Copilot plan, organization-billed inference can use GITHUB_TOKEN when the relevant organization policy is enabled. The workflow must opt into the copilot-requests permission with the value write. This permission enables model inference, not repository mutation. Personal repositories instead need the documented Copilot token secret; third-party engines need their applicable credentials. Keep credential values out of workflow prose and source control.
Translate the design into configuration and instructions
Frontmatter, enclosed by --- delimiters, carries configuration. The Markdown after it carries natural-language instructions. The on field selects triggers; engine selects the AI engine; tools identifies available capabilities. Event triggers use GitHub Actions syntax, and GitHub's documented workflow example also supports the schedule expression weekly on monday.
In this example, maintainers want one weekly issue summarizing unresolved issue themes. They have approved organization-billed Copilot inference and issue creation. Save the following complete file as .github/workflows/weekly-issue-brief.md:
---
on: weekly on monday
engine: copilot
permissions:
issues: read
copilot-requests: write
network: defaults
tools:
github:
toolsets: [issues]
safe-outputs:
create-issue:
---
# Weekly issue brief
Prepare a weekly brief for this repository's maintainers using issues
updated during the preceding seven days.
Group unresolved issues by the operational problem they describe.
For each theme, cite the supporting issue numbers, explain the evidence,
and distinguish a confirmed blocker from a suspected dependency.
Create one report issue with a date range, themes, uncertain conclusions,
and questions that need a maintainer's decision. Do not close, relabel,
or assign existing issues. If the source data is unavailable, explain
that limitation instead of inventing activity or a zero count.
The example's authentication assumption is essential: its inference permission requires the organization setup described above. The issues toolset supplies issue capabilities, while the read permission supplies the relevant GitHub access. These settings answer different questions and must fit the task together. The declared create-issue safe output requests issue creation through a separate permission-controlled job; it does not give the agent direct issue-write access. Depending on configuration and policy, safe outputs can apply actions automatically, so review the permitted effect before enabling runs.
This breakdown applies GitHub's prompt guidance: make the goal specific, divide complex work, provide relevant context and review the result. Define the reporting window and uncertainty behavior before adding stylistic instructions. A fluent summary with an undefined time range is difficult to verify.
Compile and inspect both artifacts
From the repository root, after checking the prerequisites, run:
gh aw compile
For this example, the expected companion is .github/workflows/weekly-issue-brief.lock.yml. Compilation may refresh other workflow lock files in the repository too, so inspect the complete generated diff before committing. Keep the authored Markdown and generated YAML together; do not hand-edit the lock file to conceal a source error.
Check the compiler's actual result and diagnostics, then inspect the newly generated file. An old lock file remaining on disk does not prove the current source compiled. If compilation fails, preserve the diagnostic, correct the source, and compile again before describing the configuration as validated.
Keep a short verification record when you test the example:
| Record | What to retain |
|---|---|
| Source | The exact Markdown filename and revision compiled. |
| Tool versions | The installed GitHub CLI and gh-aw versions used for that attempt. |
| Compilation | The command, actual exit result and relevant diagnostics. |
| Generated configuration | The actual lock filename and reviewed source/lock diff. |
| Workflow execution | A separate run result, or an explicit statement that no run was performed. |
A successful compile supports the configuration claim only. Before enabling execution, check authentication for the selected engine, the repository's actual policies and the permitted safe outputs. A successful Actions run then needs its own logs and output review; compilation cannot establish that the issue brief contains accurate themes or supported conclusions.
GitHub documents compilation-time schema validation, expression checks and action pinning. Inspect the generated configuration against the intended task:
- The trigger and reporting period still match the weekly requirement.
- The issues toolset and read permission support the stated inputs.
- Issue creation remains the declared effect; existing issues must not be closed, relabeled or assigned by this task.
- Inference authentication matches the repository ownership and engine.
- Each proposed report theme can be challenged against its cited issue evidence.
These checks connect the implementation to the business requirement. A structurally valid instruction to summarize “all important work” still leaves the reporting scope unresolved.
Keep source and lock changes aligned
Update the Markdown source, rerun gh aw compile, and review both updated files before committing them together. Use a pull request and inspect the applicable GitHub Actions checks. Treat source and generated output as one reviewable change.
Use the following change-impact checks when the weekly brief requirements change:
| Requirement change | Authoring review needed |
|---|---|
| Shorten the brief while preserving its evidence | Adjust instructions; confirm required evidence remains; recompile and review both diffs. |
| Include pull request activity | Revisit the approved input scope, tool selection and read permissions before changing the instructions. |
| Change the recurrence | Update the trigger and check that the reporting window still matches the desired period. |
| Close stale issues automatically | Return the new effect for explicit design and authority review; rewriting the task sentence alone is insufficient. |
Keep a bounded review loop: identify a specific defect, revise the relevant source, recompile and inspect the result. A request for the agent to critique its wording is an instruction pattern, not a universal configuration field or a guarantee of correctness. When requirements change the workflow's permitted effects, continue with GH-700: Constrain Workflow Effects with Permissions and Safe Outputs before enabling the revised behavior.
Authoritative Sources
- Creating GitHub Agentic Workflows — prerequisites, authoring commands, weekly schedule example and source/lock update procedure.
- GitHub Agentic Workflows concepts — Markdown-to-Actions lifecycle and runtime distinction.
- Frontmatter reference — trigger, engine, network and tool configuration.
- GitHub Tools Read Permissions — read scopes and organization-billed Copilot inference permission.
- Safe Outputs — declared action requests and separate execution jobs.
- Security Architecture — compilation-time validation and its runtime boundary.
- Prompt engineering for GitHub Copilot — specific requirements, decomposition, context and output review.

