56 Commits

Author SHA1 Message Date
Peter Evans
ce5485de42 Merge pull request #51 from peter-evans/not-found-error
Improve error message for 404 errors
2020-11-11 16:12:02 +09:00
Peter Evans
eed51ed4c3 Improve error message for 404 errors 2020-11-11 16:09:35 +09:00
Peter Evans
938c2224dd Merge pull request #46 from peter-evans/update-dependencies
Update dependencies
2020-11-11 15:45:07 +09:00
actions-bot
d1b7bfe3a6 Update dependencies 2020-11-05 01:11:15 +00:00
Peter Evans
8031fbaca8 Merge pull request #48 from peter-evans/update-distribution
Update distribution
2020-10-02 15:16:49 +09:00
peter-evans
f1680f525a Update distribution 2020-10-02 06:09:25 +00:00
Peter Evans
5fda2f7d98 Merge pull request #47 from peter-evans/dependabot/npm_and_yarn/actions/core-1.2.6
Bump @actions/core from 1.2.5 to 1.2.6
2020-10-02 15:07:56 +09:00
dependabot[bot]
031f27b115 Bump @actions/core from 1.2.5 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 17:24:37 +00:00
Peter Evans
c49e1666ac Merge pull request #44 from staabm/patch-1
Mention string length limitations
2020-09-24 11:08:22 +09:00
Markus Staab
111788c696 Update README.md 2020-09-24 11:05:07 +09:00
Markus Staab
f131b1d1f9 Update README.md 2020-09-24 11:05:07 +09:00
Peter Evans
95531d6358 Merge pull request #45 from peter-evans/update-distribution
Update distribution
2020-09-22 08:56:42 +09:00
peter-evans
b4caad9acd Update distribution 2020-09-21 23:56:30 +00:00
Peter Evans
543acfac4e Merge pull request #37 from peter-evans/update-dependencies
Update dependencies
2020-09-22 08:55:27 +09:00
Markus Staab
1b0d3fa47b Update README.md 2020-09-19 07:59:30 +02:00
Markus Staab
6de120f0ca Update README.md 2020-09-19 07:58:31 +02:00
Markus Staab
1f8e017ab8 Mention string length limitations 2020-09-19 07:56:36 +02:00
actions-bot
4e1995c760 Update dependencies 2020-09-17 01:13:09 +00:00
Peter Evans
7d5ca7bf80 Merge pull request #43 from peter-evans/update-distribution
Update distribution
2020-09-13 15:09:49 +09:00
peter-evans
618fe4e18f Update distribution 2020-09-13 06:08:13 +00:00
Peter Evans
8f8aeefe6e Merge pull request #42 from peter-evans/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-13 15:06:51 +09:00
dependabot[bot]
c5318edea4 Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 10:25:06 +00:00
Peter Evans
438514a476 Merge pull request #41 from peter-evans/update-ncc
Update ncc
2020-08-22 15:29:58 +09:00
Peter Evans
216dea92e3 Update ncc 2020-08-22 15:28:17 +09:00
Peter Evans
c0fe68ba01 Update readme 2020-08-04 15:54:46 +09:00
Peter Evans
21c5610af0 Update slash-command-dispatch to v2 2020-07-25 13:45:08 +09:00
Peter Evans
754562405e Update create-pull-request action to v3 2020-07-23 16:05:30 +09:00
Peter Evans
a12578c2e0 Merge pull request #36 from peter-evans/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-07-20 17:43:59 +09:00
dependabot[bot]
0e075ee1a0 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-20 08:41:32 +00:00
Peter Evans
3b28b4b04f Merge pull request #35 from peter-evans/update-distribution
Update distribution
2020-07-19 18:06:42 +09:00
peter-evans
9e58632f8a Update distribution 2020-07-19 09:06:12 +00:00
Peter Evans
163f36102f Merge pull request #30 from peter-evans/update-dependencies
Update dependencies
2020-07-19 18:04:45 +09:00
actions-bot
4532a8fb51 Update dependencies 2020-07-16 01:05:50 +00:00
Peter Evans
f540f114fd Update readme 2020-06-25 09:13:39 +09:00
Peter Evans
1c51dc3383 Merge pull request #31 from cbetta/patch-1
Clarify that PAT owner needs to have repo access
2020-06-25 09:12:02 +09:00
Cristiano Betta
8e9f439e9f Clarify that PAT owner needs to have repo access
Ran into an issue where I was using a user that did not have explicit access to the repo that I was trying to trigger an event for. I'm not sure if the user needs write access to the repo, but it seems logical to me that someone with `read` only access can not trigger GH actions.
2020-06-24 14:57:02 +01:00
Peter Evans
1708dda570 Merge pull request #27 from peter-evans/update-dependencies
Update dependencies
2020-06-04 15:28:27 +09:00
Peter Evans
eb329a2e6a Fix for github v3 2020-06-04 15:25:58 +09:00
actions-bot
7aa158e97c Update dependencies 2020-06-04 01:05:19 +00:00
Peter Evans
35f05e8e06 Fix ci artifacts 2020-06-02 18:37:55 +09:00
Peter Evans
f0c6ad7fa3 Fix prettier glob pattern 2020-06-02 18:37:38 +09:00
Peter Evans
fe5946ba71 Update slash command dispatch 2020-06-02 18:37:24 +09:00
Peter Evans
7ecf080487 Update README 2020-05-29 10:21:14 +09:00
Peter Evans
c830a9705e Update README 2020-05-25 18:16:20 +09:00
Peter Evans
ed97383570 Add rebase slash command 2020-05-25 17:30:29 +09:00
Peter Evans
b410ea76d1 Skip test job for pull requests from forks 2020-05-13 17:23:47 +09:00
Peter Evans
7fe6653bc4 Merge pull request #26 from peter-evans/update-distribution
Update distribution
2020-05-13 11:41:29 +09:00
peter-evans
d874befdda Update distribution 2020-05-13 02:41:01 +00:00
Peter Evans
9f64758ff8 Merge pull request #25 from peter-evans/update-dependencies
Update dependencies
2020-05-13 11:39:27 +09:00
actions-bot
e42b4b7b55 Update dependencies 2020-05-07 01:03:09 +00:00
Peter Evans
cb588ee63a Ignore documentation paths 2020-05-06 11:41:48 +09:00
Peter Evans
41bdbb0627 Add update dependencies workflow 2020-05-06 10:00:17 +09:00
Renovate Bot
d47934dfd8 Update dependency @types/node to v13.13.5 2020-05-05 21:45:53 +00:00
Renovate Bot
34d557382e Update jest monorepo to v26.0.1 2020-05-05 12:45:41 +00:00
Peter Evans
a4bb1fc8bc Add ci badge 2020-05-05 14:11:28 +09:00
Peter Evans
f9ec82f96b Update input description 2020-05-05 09:17:05 +09:00
10 changed files with 9390 additions and 27656 deletions

View File

@@ -2,8 +2,14 @@ name: CI
on:
push:
branches: [master]
paths-ignore:
- 'README.md'
- 'docs/**'
pull_request:
branches: [master]
paths-ignore:
- 'README.md'
- 'docs/**'
jobs:
build:
runs-on: ubuntu-latest
@@ -21,8 +27,13 @@ jobs:
with:
name: dist
path: dist
- uses: actions/upload-artifact@v2
with:
name: action.yml
path: action.yml
test:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
needs: [build]
runs-on: ubuntu-latest
strategy:
@@ -35,6 +46,11 @@ jobs:
with:
name: dist
path: dist
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v2
with:
name: action.yml
path: .
- name: Test repository dispatch
uses: ./
@@ -60,11 +76,9 @@ jobs:
name: dist
path: dist
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update distribution
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: Update distribution
body: |
- Updates the distribution for changes on `master`

View File

@@ -0,0 +1,21 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
config: >
[
{
"command": "rebase",
"permission": "admin",
"repository": "peter-evans/slash-command-dispatch-processor",
"issue_type": "pull-request"
}
]

31
.github/workflows/update-dep.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
name: Update Dependencies
on:
schedule:
- cron: '0 1 * * 4'
jobs:
update-dep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Update dependencies
run: |
npx -p npm-check-updates ncu -u
npm install
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
commit-message: Update dependencies
committer: GitHub <noreply@github.com>
author: actions-bot <actions-bot@users.noreply.github.com>
title: Update dependencies
body: |
- Dependency updates
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-dependencies

View File

@@ -1,4 +1,5 @@
# Repository Dispatch
[![CI](https://github.com/peter-evans/repository-dispatch/workflows/CI/badge.svg)](https://github.com/peter-evans/repository-dispatch/actions?query=workflow%3ACI)
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-Repository%20Dispatch-blue.svg?colorA=24292e&colorB=0366d6&style=flat&longCache=true&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAM6wAADOsB5dZE0gAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAERSURBVCiRhZG/SsMxFEZPfsVJ61jbxaF0cRQRcRJ9hlYn30IHN/+9iquDCOIsblIrOjqKgy5aKoJQj4O3EEtbPwhJbr6Te28CmdSKeqzeqr0YbfVIrTBKakvtOl5dtTkK+v4HfA9PEyBFCY9AGVgCBLaBp1jPAyfAJ/AAdIEG0dNAiyP7+K1qIfMdonZic6+WJoBJvQlvuwDqcXadUuqPA1NKAlexbRTAIMvMOCjTbMwl1LtI/6KWJ5Q6rT6Ht1MA58AX8Apcqqt5r2qhrgAXQC3CZ6i1+KMd9TRu3MvA3aH/fFPnBodb6oe6HM8+lYHrGdRXW8M9bMZtPXUji69lmf5Cmamq7quNLFZXD9Rq7v0Bpc1o/tp0fisAAAAASUVORK5CYII=)](https://github.com/marketplace/actions/repository-dispatch)
A GitHub action to create a repository dispatch event.
@@ -17,11 +18,17 @@ A GitHub action to create a repository dispatch event.
| Name | Description | Default |
| --- | --- | --- |
| `token` | (**required**) A `repo` scoped GitHub [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). | |
| `token` | (**required**) A `repo` scoped GitHub [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). See [token](#token) for further details. | |
| `repository` | The full name of the repository to send the dispatch. | `github.repository` (current repository) |
| `event-type` | (**required**) A custom webhook event name. | |
| `client-payload` | JSON payload with extra information about the webhook event that your action or workflow may use. | `{}` |
#### `token`
This action creates [`repository_dispatch`](https://developer.github.com/v3/repos/#create-a-repository-dispatch-event) events.
The default `GITHUB_TOKEN` does not have scopes to do this so a `repo` scoped [PAT](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) created on a user with `write` access to the target repository is required.
If you will be dispatching to a public repository then you can use the more limited `public_repo` scope.
## Example
Here is an example setting all of the input parameters.
@@ -54,6 +61,30 @@ jobs:
- run: echo ${{ github.event.client_payload.sha }}
```
### Dispatch to multiple repositories
You can dispatch to multiple repositories by using a [matrix strategy](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix). In the following example, after the `build` job succeeds, an event is dispatched to three different repositories.
```yml
jobs:
build:
# Main workflow job that builds, tests, etc.
dispatch:
needs: build
strategy:
matrix:
repo: ['my-org/repo1', 'my-org/repo2', 'my-org/repo3']
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: ${{ matrix.repo }}
event-type: my-event
```
## Client payload
The GitHub API allows a maximum of 10 top-level properties in the `client-payload` JSON.
@@ -76,6 +107,8 @@ The following payload will succeed.
client-payload: '{"github": ${{ toJson(github) }}}'
```
Additionally, there is a limitation on the total data size of the `client-payload`. A very large payload may result in a `client_payload is too large` error.
## License
[MIT](LICENSE)

View File

@@ -5,7 +5,7 @@ inputs:
description: 'A repo scoped GitHub Personal Access Token'
required: true
repository:
description: 'The full name of the repository to send the dispatch. Defaults to the current repository.'
description: 'The full name of the repository to send the dispatch.'
default: ${{ github.repository }}
event-type:
description: 'A custom webhook event name.'

30700
dist/index.js vendored

File diff suppressed because it is too large Load Diff

6182
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -6,8 +6,8 @@
"main": "lib/main.js",
"scripts": {
"build": "tsc && ncc build",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"test": "jest --passWithNoTests"
},
@@ -27,22 +27,22 @@
},
"homepage": "https://github.com/peter-evans/repository-dispatch#readme",
"dependencies": {
"@actions/core": "1.2.4",
"@actions/github": "2.1.1"
"@actions/core": "1.2.6",
"@actions/github": "4.0.0"
},
"devDependencies": {
"@types/jest": "25.2.1",
"@types/node": "13.13.4",
"@typescript-eslint/parser": "2.31.0",
"@zeit/ncc": "0.20.5",
"eslint": "6.8.0",
"eslint-plugin-github": "3.4.1",
"eslint-plugin-jest": "23.9.0",
"jest": "26.0.0",
"jest-circus": "26.0.0",
"js-yaml": "3.13.1",
"prettier": "2.0.5",
"ts-jest": "25.4.0",
"typescript": "3.8.3"
"@types/jest": "26.0.15",
"@types/node": "14.14.6",
"@typescript-eslint/parser": "4.6.1",
"@vercel/ncc": "0.24.1",
"eslint": "7.12.1",
"eslint-plugin-github": "4.1.1",
"eslint-plugin-jest": "24.1.0",
"jest": "26.6.3",
"jest-circus": "26.6.3",
"js-yaml": "3.14.0",
"prettier": "2.1.2",
"ts-jest": "26.4.3",
"typescript": "4.0.5"
}
}

View File

@@ -1,11 +0,0 @@
{
"extends": [
"config:base"
],
"packageRules": [
{
"depTypeList": ["devDependencies"],
"automerge": true
}
]
}

View File

@@ -14,7 +14,7 @@ async function run(): Promise<void> {
const [owner, repo] = inputs.repository.split('/')
const octokit = new github.GitHub(inputs.token)
const octokit = github.getOctokit(inputs.token)
await octokit.repos.createDispatchEvent({
owner: owner,
@@ -24,7 +24,13 @@ async function run(): Promise<void> {
})
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
if (error.status == 404) {
core.setFailed(
'Repository not found, OR token has insufficient permissions.'
)
} else {
core.setFailed(error.message)
}
}
}