You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See [GitHub's permissions reference](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) for the complete list.
33
+
Key permissions include `contents` (code access), `issues` (issue management), `pull-requests` (PR management), `discussions`, `actions` (workflow control), `checks`, `deployments`, `packages`, `pages`, and `statuses`. Each has read and write levels. See [GitHub's permissions reference](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) for the complete list.
Equivalent to setting all permissions to `read`. This is useful for workflows that need to inspect various repository data without making changes.
49
+
### Shorthand Options
69
50
70
-
### Write-All Permissions (Not Recommended)
51
+
- **`read-all`**: Read access to all scopes (useful for inspection workflows)
52
+
- **`{}`**: No permissions (for computation-only workflows)
71
53
72
54
:::caution
73
-
Avoid `write-all` in agentic workflows. Use specific permissions with safe outputs instead.
55
+
Avoid using `write-all` or direct write permissions in agentic workflows. Use [safe outputs](/gh-aw/reference/safe-outputs/) instead for secure write operations.
74
56
:::
75
57
76
-
```yaml wrap
77
-
permissions: write-all
78
-
```
79
-
80
-
This grants write access to all scopes and should only be used when absolutely necessary, such as for administrative automation tasks with strict access controls.
81
-
82
-
### No Permissions
83
-
84
-
Disable all permissions:
85
-
86
-
```yaml wrap
87
-
permissions: {}
88
-
```
89
-
90
-
Useful for workflows that only perform computation without accessing GitHub APIs.
91
-
92
58
## Common Patterns
93
59
94
-
### IssueOps Workflow
95
-
96
-
Read repository content, write to issues:
60
+
All workflows should use read-only permissions with safe outputs for write operations:
97
61
98
62
```yaml wrap
99
-
on:
100
-
issues:
101
-
types: [opened]
63
+
# IssueOps: Read code, comment via safe outputs
102
64
permissions:
103
65
contents: read
104
-
issues: write
66
+
actions: read
105
67
safe-outputs:
106
68
add-comment:
107
69
max: 5
108
-
```
109
-
110
-
The main AI job runs with `contents: read`. Comment creation happens in a separate safe output job with `issues: write`, ensuring AI-generated content is sanitized before posting.
111
-
112
-
### PR Review Workflow
113
70
114
-
Read pull requests, add review comments:
115
-
116
-
```yaml wrap
117
-
on:
118
-
pull_request:
119
-
types: [opened, synchronize]
71
+
# PR Review: Read code, review via safe outputs
120
72
permissions:
121
73
contents: read
122
-
pull-requests: write
74
+
actions: read
123
75
safe-outputs:
124
76
create-pr-review-comment:
125
77
max: 10
126
-
```
127
-
128
-
### Scheduled Analysis
129
78
130
-
Read-only analysis that creates issues:
131
-
132
-
```yaml wrap
133
-
on:
134
-
schedule:
135
-
- cron: "0 9 * * 1"
79
+
# Scheduled: Analysis with issue creation via safe outputs
136
80
permissions:
137
81
contents: read
138
-
issues: write
82
+
actions: read
139
83
safe-outputs:
140
84
create-issue:
141
85
max: 3
142
-
```
143
86
144
-
### Manual Workflow
145
-
146
-
Maximum permissions for administrative tasks:
147
-
148
-
```yaml wrap
149
-
on:
150
-
workflow_dispatch:
87
+
# Manual: Admin tasks with approval gate
151
88
permissions: read-all
152
89
manual-approval: production
153
90
```
154
91
155
-
Uses manual approval gate for human oversight before execution.
156
-
157
92
## Safe Outputs
158
93
159
-
Write operations should use safe outputs rather than direct API access:
- Security isolation (write permissions separated from AI execution)
176
-
177
-
See [Safe Outputs](/gh-aw/reference/safe-outputs/) for complete documentation.
94
+
Write operations use safe outputs instead of direct API access. This provides content sanitization, rate limiting, audit trails, and security isolation by separating write permissions from AI execution. See [Safe Outputs](/gh-aw/reference/safe-outputs/) for details.
178
95
179
96
## Permission Validation
180
97
181
-
The compiler validates permissions during compilation:
- Write permissions without safe outputs (security risk)
190
-
- Insufficient permissions for declared tools
191
-
192
-
Use `--strict` mode for additional permission validation:
193
-
194
-
```bash
195
-
gh aw compile --strict workflow.md
196
-
```
197
-
198
-
Strict mode refuses write permissions and requires explicit network configuration for all operations.
98
+
Run `gh aw compile workflow.md` to validate permissions. Common errors include undefined permissions, direct write permissions in the main job (use safe outputs instead), and insufficient permissions for declared tools. Use `--strict` mode to enforce read-only permissions and require explicit network configuration.
0 commit comments