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
- Load `app-permissions` from schema exported by `@octokit/openapi`
- Update documentation in README.md
- Implement the `permissions_*` inputs in the action code
---------
Co-authored-by: Parker Brown <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+54-18
Original file line number
Diff line number
Diff line change
@@ -121,7 +121,7 @@ jobs:
121
121
122
122
> [!TIP]
123
123
> The `<BOT USER ID>` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/<app-slug>%5Bbot%5D`.
124
-
>
124
+
>
125
125
> For example, we can check at `https://api.github.com/users/dependabot[bot]` to see the user ID of Dependabot is 49699333.
126
126
>
127
127
> Alternatively, you can use the [octokit/request-action](https://github.com/octokit/request-action) to get the ID.
@@ -195,6 +195,32 @@ jobs:
195
195
body: "Hello, World!"
196
196
```
197
197
198
+
### Create a token with specific permissions
199
+
200
+
> [!NOTE]
201
+
> Selected permissions must be granted to the installation of the specified app and repository owner. Setting a permission that the installation does not have will result in an error.
202
+
203
+
```yaml
204
+
on: [issues]
205
+
206
+
jobs:
207
+
hello-world:
208
+
runs-on: ubuntu-latest
209
+
steps:
210
+
- uses: actions/create-github-app-token@v1
211
+
id: app-token
212
+
with:
213
+
app-id: ${{ vars.APP_ID }}
214
+
private-key: ${{ secrets.PRIVATE_KEY }}
215
+
owner: ${{ github.repository_owner }}
216
+
permission-issues: write
217
+
- uses: peter-evans/create-or-update-comment@v3
218
+
with:
219
+
token: ${{ steps.app-token.outputs.token }}
220
+
issue-number: ${{ github.event.issue.number }}
221
+
body: "Hello, World!"
222
+
```
223
+
198
224
### Create tokens for multiple user or organization accounts
199
225
200
226
You can use a matrix strategy to create tokens for multiple user or organization accounts.
> If `owner` is set and `repositories` is empty, access will be scoped to all repositories in the provided repository owner's installation. If `owner` and `repositories` are empty, access will be scoped to only the current repository.
311
337
338
+
### `permission-<permission name>`
339
+
340
+
**Optional:** The permissions to grant to the token. By default, the token inherits all of the installation's permissions. We recommend to explicitly list the permissions that are required for a use case. This follows GitHub's own recommendation to [control permissions of `GITHUB_TOKEN` in workflows](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token). The documentation also lists all available permissions, just prefix the permission key with `permission-` (e.g., `pull-requests` → `permission-pull-requests`).
341
+
342
+
The reason we define one `permision-<permission name>` input per permission is to benefit from type intelligence and input validation built into GitHub's action runner.
343
+
312
344
### `skip-token-revoke`
313
345
314
346
**Optional:** If truthy, the token will not be revoked when the current job is complete.
@@ -344,6 +376,10 @@ The action creates an installation access token using [the `POST /app/installati
344
376
> [!NOTE]
345
377
> Installation permissions can differ from the app's permissions they belong to. Installation permissions are set when an app is installed on an account. When the app adds more permissions after the installation, an account administrator will have to approve the new permissions before they are set on the installation.
Copy file name to clipboardExpand all lines: action.yml
+98
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,104 @@ inputs:
37
37
github-api-url:
38
38
description: The URL of the GitHub REST API.
39
39
default: ${{ github.api_url }}
40
+
# <START GENERATED PERMISSIONS INPUTS>
41
+
permission-actions:
42
+
description: "The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be set to 'read' or 'write'."
43
+
permission-administration:
44
+
description: "The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be set to 'read' or 'write'."
45
+
permission-checks:
46
+
description: "The level of permission to grant the access token for checks on code. Can be set to 'read' or 'write'."
47
+
permission-codespaces:
48
+
description: "The level of permission to grant the access token to create, edit, delete, and list Codespaces. Can be set to 'read' or 'write'."
49
+
permission-contents:
50
+
description: "The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be set to 'read' or 'write'."
51
+
permission-dependabot-secrets:
52
+
description: "The leve of permission to grant the access token to manage Dependabot secrets. Can be set to 'read' or 'write'."
53
+
permission-deployments:
54
+
description: "The level of permission to grant the access token for deployments and deployment statuses. Can be set to 'read' or 'write'."
55
+
permission-email-addresses:
56
+
description: "The level of permission to grant the access token to manage the email addresses belonging to a user. Can be set to 'read' or 'write'."
57
+
permission-environments:
58
+
description: "The level of permission to grant the access token for managing repository environments. Can be set to 'read' or 'write'."
59
+
permission-followers:
60
+
description: "The level of permission to grant the access token to manage the followers belonging to a user. Can be set to 'read' or 'write'."
61
+
permission-git-ssh-keys:
62
+
description: "The level of permission to grant the access token to manage git SSH keys. Can be set to 'read' or 'write'."
63
+
permission-gpg-keys:
64
+
description: "The level of permission to grant the access token to view and manage GPG keys belonging to a user. Can be set to 'read' or 'write'."
65
+
permission-interaction-limits:
66
+
description: "The level of permission to grant the access token to view and manage interaction limits on a repository. Can be set to 'read' or 'write'."
67
+
permission-issues:
68
+
description: "The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be set to 'read' or 'write'."
69
+
permission-members:
70
+
description: "The level of permission to grant the access token for organization teams and members. Can be set to 'read' or 'write'."
71
+
permission-metadata:
72
+
description: "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be set to 'read' or 'write'."
73
+
permission-organization-administration:
74
+
description: "The level of permission to grant the access token to manage access to an organization. Can be set to 'read' or 'write'."
75
+
permission-organization-announcement-banners:
76
+
description: "The level of permission to grant the access token to view and manage announcement banners for an organization. Can be set to 'read' or 'write'."
77
+
permission-organization-copilot-seat-management:
78
+
description: "The level of permission to grant the access token for managing access to GitHub Copilot for members of an organization with a Copilot Business subscription. This property is in public preview and is subject to change. Can be set to 'write'."
79
+
permission-organization-custom-org-roles:
80
+
description: "The level of permission to grant the access token for custom organization roles management. Can be set to 'read' or 'write'."
81
+
permission-organization-custom-properties:
82
+
description: "The level of permission to grant the access token for custom property management. Can be set to 'read', 'write', or 'admin'."
83
+
permission-organization-custom-roles:
84
+
description: "The level of permission to grant the access token for custom repository roles management. Can be set to 'read' or 'write'."
85
+
permission-organization-events:
86
+
description: "The level of permission to grant the access token to view events triggered by an activity in an organization. Can be set to 'read'."
87
+
permission-organization-hooks:
88
+
description: "The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be set to 'read' or 'write'."
89
+
permission-organization-packages:
90
+
description: "The level of permission to grant the access token for organization packages published to GitHub Packages. Can be set to 'read' or 'write'."
description: "The level of permission to grant the access token for viewing and managing fine-grained personal access tokens that have been approved by an organization. Can be set to 'read' or 'write'."
93
+
permission-organization-personal-access-tokens:
94
+
description: "The level of permission to grant the access token for viewing and managing fine-grained personal access token requests to an organization. Can be set to 'read' or 'write'."
95
+
permission-organization-plan:
96
+
description: "The level of permission to grant the access token for viewing an organization's plan. Can be set to 'read'."
97
+
permission-organization-projects:
98
+
description: "The level of permission to grant the access token to manage organization projects and projects public preview (where available). Can be set to 'read', 'write', or 'admin'."
99
+
permission-organization-secrets:
100
+
description: "The level of permission to grant the access token to manage organization secrets. Can be set to 'read' or 'write'."
101
+
permission-organization-self-hosted-runners:
102
+
description: "The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be set to 'read' or 'write'."
103
+
permission-organization-user-blocking:
104
+
description: "The level of permission to grant the access token to view and manage users blocked by the organization. Can be set to 'read' or 'write'."
105
+
permission-packages:
106
+
description: "The level of permission to grant the access token for packages published to GitHub Packages. Can be set to 'read' or 'write'."
107
+
permission-pages:
108
+
description: "The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be set to 'read' or 'write'."
109
+
permission-profile:
110
+
description: "The level of permission to grant the access token to manage the profile settings belonging to a user. Can be set to 'write'."
111
+
permission-pull-requests:
112
+
description: "The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be set to 'read' or 'write'."
113
+
permission-repository-custom-properties:
114
+
description: "The level of permission to grant the access token to view and edit custom properties for a repository, when allowed by the property. Can be set to 'read' or 'write'."
115
+
permission-repository-hooks:
116
+
description: "The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be set to 'read' or 'write'."
117
+
permission-repository-projects:
118
+
description: "The level of permission to grant the access token to manage repository projects, columns, and cards. Can be set to 'read', 'write', or 'admin'."
119
+
permission-secret-scanning-alerts:
120
+
description: "The level of permission to grant the access token to view and manage secret scanning alerts. Can be set to 'read' or 'write'."
121
+
permission-secrets:
122
+
description: "The level of permission to grant the access token to manage repository secrets. Can be set to 'read' or 'write'."
123
+
permission-security-events:
124
+
description: "The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be set to 'read' or 'write'."
125
+
permission-single-file:
126
+
description: "The level of permission to grant the access token to manage just a single file. Can be set to 'read' or 'write'."
127
+
permission-starring:
128
+
description: "The level of permission to grant the access token to list and manage repositories a user is starring. Can be set to 'read' or 'write'."
129
+
permission-statuses:
130
+
description: "The level of permission to grant the access token for commit statuses. Can be set to 'read' or 'write'."
131
+
permission-team-discussions:
132
+
description: "The level of permission to grant the access token to manage team discussions and related comments. Can be set to 'read' or 'write'."
133
+
permission-vulnerability-alerts:
134
+
description: "The level of permission to grant the access token to manage Dependabot alerts. Can be set to 'read' or 'write'."
135
+
permission-workflows:
136
+
description: "The level of permission to grant the access token to update GitHub Actions workflow files. Can be set to 'write'."
0 commit comments