-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from peter-evans/ci
Add ci workflow
- Loading branch information
Showing
5 changed files
with
144 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
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: | ||
- if: github.event_name == 'push' | ||
uses: actions/checkout@v2 | ||
- if: github.event_name == 'pull_request' | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- if: matrix.target == 'built' | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
- name: Create change | ||
run: date +%s > report.txt | ||
|
||
- name: Create Pull Request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v2 | ||
with: | ||
commit-message: '[CI] test ${{ matrix.target }}' | ||
committer: GitHub <[email protected]> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
title: '[CI] test ${{ matrix.target }}' | ||
body: | | ||
- CI test case for target '${{ matrix.target }}' | ||
Auto-generated by [create-pull-request][1] | ||
[1]: https://github.com/peter-evans/create-pull-request | ||
branch: ci-test-${{ matrix.target }} | ||
|
||
- name: Close Pull | ||
uses: ./ | ||
with: | ||
pull-request-number: ${{ steps.cpr.outputs.pr_number }} | ||
comment: '[CI] test ${{ matrix.target }}' | ||
delete-branch: true | ||
|
||
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 <[email protected]> | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,56 @@ | ||
# Close Pull Request | ||
# Close Pull | ||
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-Close%20Pull-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/close-pull) | ||
|
||
A GitHub action to close a pull request and optionally delete its branch. | ||
|
||
## Usage | ||
|
||
### Close a pull request and delete its branch | ||
|
||
```yml | ||
- name: Close Pull Request | ||
- name: Close Pull | ||
uses: peter-evans/close-pull@v1 | ||
with: | ||
pull-request-number: 1 | ||
comment: Auto-closing pull request | ||
delete-branch: true | ||
``` | ||
### Reject all pull requests to a repository | ||
```yml | ||
on: | ||
pull_request: | ||
types: [opened] | ||
jobs: | ||
closePullRequest: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Close Pull | ||
uses: peter-evans/close-pull@v1 | ||
with: | ||
comment: | | ||
Sorry. Pull requests are not accepted for this repository. | ||
Auto-closing this pull request. | ||
``` | ||
### Action inputs | ||
| Name | Description | Default | | ||
| --- | --- | --- | | ||
| `token` | `GITHUB_TOKEN` or a `repo` scoped [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). | `GITHUB_TOKEN` | | ||
| `repository` | The GitHub repository containing the pull request. | Current repository | | ||
| `pull-request-number` | The number of the pull request to close. | `github.event.number` | | ||
| `comment` | A comment to make on the pull request before closing. | | | ||
| `delete-branch` | Delete the pull request branch. | `false` | | ||
|
||
Note: Deleting branches will fail silently for pull requests from forks. | ||
|
||
### Accessing pull requests in other repositories | ||
|
||
You can close pull requests in another repository by using a [PAT](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) instead of `GITHUB_TOKEN`. | ||
The user associated with the PAT must have write access to the repository. | ||
|
||
## License | ||
|
||
[MIT](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters