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
Copy file name to clipboardExpand all lines: README.md
+80-2
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ In order to use this action, you need to:
10
10
2.[Store the App's ID in your repository environment variables](https://docs.github.com/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) (example: `APP_ID`)
11
11
3.[Store the App's private key in your repository secrets](https://docs.github.com/actions/security-guides/encrypted-secrets?tool=webui#creating-encrypted-secrets-for-a-repository) (example: `PRIVATE_KEY`)
### Create a token for all repositories in the current owner's installation
61
+
62
+
```yaml
63
+
on: [workflow_dispatch]
64
+
65
+
jobs:
66
+
hello-world:
67
+
runs-on: ubuntu-latest
68
+
steps:
69
+
- uses: actions/create-github-app-token@v1
70
+
id: app-token
71
+
with:
72
+
app_id: ${{ vars.APP_ID }}
73
+
private_key: ${{ secrets.PRIVATE_KEY }}
74
+
owner: ${{ github.repository_owner }}
75
+
- uses: peter-evans/create-or-update-comment@v3
76
+
with:
77
+
token: ${{ steps.app-token.outputs.token }}
78
+
issue-number: ${{ github.event.issue.number }}
79
+
body: "Hello, World!"
80
+
```
81
+
82
+
### Create a token for multiple repositories in the current owner's installation
83
+
84
+
```yaml
85
+
on: [issues]
86
+
87
+
jobs:
88
+
hello-world:
89
+
runs-on: ubuntu-latest
90
+
steps:
91
+
- uses: actions/create-github-app-token@v1
92
+
id: app-token
93
+
with:
94
+
app_id: ${{ vars.APP_ID }}
95
+
private_key: ${{ secrets.PRIVATE_KEY }}
96
+
owner: ${{ github.repository_owner }}
97
+
repositories: "repo1,repo2"
98
+
- uses: peter-evans/create-or-update-comment@v3
99
+
with:
100
+
token: ${{ steps.app-token.outputs.token }}
101
+
issue-number: ${{ github.event.issue.number }}
102
+
body: "Hello, World!"
103
+
```
104
+
105
+
### Create a token for all repositories in another owner's installation
106
+
107
+
```yaml
108
+
on: [issues]
109
+
110
+
jobs:
111
+
hello-world:
112
+
runs-on: ubuntu-latest
113
+
steps:
114
+
- uses: actions/create-github-app-token@v1
115
+
id: app-token
116
+
with:
117
+
app_id: ${{ vars.APP_ID }}
118
+
private_key: ${{ secrets.PRIVATE_KEY }}
119
+
owner: another-owner
120
+
- uses: peter-evans/create-or-update-comment@v3
121
+
with:
122
+
token: ${{ steps.app-token.outputs.token }}
123
+
issue-number: ${{ github.event.issue.number }}
124
+
body: "Hello, World!"
125
+
```
126
+
60
127
## Inputs
61
128
62
129
### `app_id`
@@ -67,6 +134,17 @@ jobs:
67
134
68
135
**Required:** GitHub App private key.
69
136
137
+
### `owner`
138
+
139
+
**Optional:** GitHub App installation owner. If empty, defaults to the current repository owner.
140
+
141
+
### `repositories`
142
+
143
+
**Optional:** Comma-separated list of repositories to grant access to.
144
+
145
+
> [!NOTE]
146
+
> 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.
The action creates an installation access token using [the `POST /app/installations/{installation_id}/access_tokens` endpoint](https://docs.github.com/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app). By default,
79
157
80
-
1. The token is scoped to the current repository.
158
+
1. The token is scoped to the current repository or `repositories` if set.
81
159
2. The token inherits all the installation's permissions.
82
160
3. The token is set as output `token` which can be used in subsequent steps.
83
161
4. The token is revoked in the `post` step of the action, which means it cannot be passed to another job.
0 commit comments