Add ci workflow

This commit is contained in:
Peter Evans
2020-05-02 17:25:16 +09:00
parent 22b027c6f6
commit 80521239f3
7 changed files with 6416 additions and 40 deletions

17
.eslintrc.json Normal file
View File

@@ -0,0 +1,17 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}

67
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: npm ci
- run: npm run test
- run: npm run package
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
test:
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
target: [built, committed]
steps:
- uses: actions/checkout@v2
- if: matrix.target == 'built'
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Repository Dispatch
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: tests
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
package:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
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`
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-distribution

View File

@@ -1,13 +0,0 @@
name: Create Repository Dispatch
on: push
jobs:
createRepositoryDispatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Repository Dispatch
uses: ./
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: tests
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

6339
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,9 +2,11 @@
"name": "repository-dispatch",
"version": "1.0.0",
"description": "Create a repository dispatch event",
"main": "index.js",
"main": "src/index.js",
"scripts": {
"package": "ncc build index.js -o dist"
"lint": "eslint src/index.js",
"package": "ncc build src/index.js -o dist",
"test": "eslint src/index.js && jest --passWithNoTests"
},
"repository": {
"type": "git",
@@ -18,10 +20,12 @@
},
"homepage": "https://github.com/peter-evans/repository-dispatch#readme",
"dependencies": {
"@actions/core": "^1.1.1",
"@octokit/request": "^5.1.0"
"@actions/core": "1.2.0",
"@octokit/request": "5.3.1"
},
"devDependencies": {
"@zeit/ncc": "0.22.1"
"@zeit/ncc": "0.22.1",
"eslint": "6.8.0",
"jest": "25.5.3"
}
}

View File

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