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
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,22 @@ A GitHub action to create a repository dispatch event.
6
6
7
7
## Usage
8
8
9
+
Dispatch to the current repository by elivating the permissions of the default `GITHUB_TOKEN`.
10
+
```yml
11
+
permissions:
12
+
actions: write
13
+
14
+
jobs:
15
+
repositorydispatch:
16
+
runs-on: ubuntu-latest
17
+
steps:
18
+
- name: Repository Dispatch
19
+
uses: peter-evans/repository-dispatch@v2
20
+
with:
21
+
event-type: my-event
22
+
```
23
+
24
+
Dispatch to a remote repository using a `repo` scoped GitHub [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).
9
25
```yml
10
26
- name: Repository Dispatch
11
27
uses: peter-evans/repository-dispatch@v2
@@ -18,22 +34,23 @@ A GitHub action to create a repository dispatch event.
18
34
19
35
| Name | Description | Default |
20
36
| --- | --- | --- |
21
-
| `token` | (**required**) A GitHub access token with `actions: write` permission to the repository being dispatched. | |
37
+
| `token` | (**required**) `GITHUB_TOKEN` (permissions `actions: write`) or a `repo` scoped [Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). See [token](#token) for further details. | `GITHUB_TOKEN` |
22
38
| `repository` | The full name of the repository to send the dispatch. | `github.repository` (current repository) |
| `client-payload` | JSON payload with extra information about the webhook event that your action or workflow may use. | `{}` |
25
41
26
42
#### `token`
27
43
28
-
This action creates [`repository_dispatch`](https://developer.github.com/v3/repos/#create-a-repository-dispatch-event) events. The default `GITHUB_TOKEN`
29
-
token can only be used if you are dispatching the same repo. In this case you must assign the permission `action: write` to the token, see [permissions api](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs). Example:
44
+
This action creates [`repository_dispatch`](https://developer.github.com/v3/repos/#create-a-repository-dispatch-event) events.
45
+
The default `GITHUB_TOKEN` token can only be used if you are dispatching the same repository that the workflow is executing in.
46
+
In this case you must [elevate the token permissions](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) to allow the dispatch.
47
+
30
48
```yaml
31
49
permissions:
32
50
actions: write
33
51
```
34
52
35
-
The solution to trigger other repositories is to manually create a [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) and store it as a secret e.g. `${{ secrets.PERSONAL_TOKEN }}`.
36
-
53
+
To dispatch to a remote repository you must create a [Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) with the `repo` scope and store it as a secret.
37
54
If you will be dispatching to a public repository then you can use the more limited `public_repo` scope.
0 commit comments