2021-05-07 16:36:52 +00:00
|
|
|
name: PR status checks
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [assigned, opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
node-version: [16.x]
|
|
|
|
steps:
|
2021-09-02 07:30:48 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
|
|
uses: actions/setup-node@v1
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node-version }}
|
|
|
|
- name: Use Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
node_modules
|
|
|
|
*/*/node_modules
|
|
|
|
key: ${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package-lock.json') }}
|
|
|
|
- name: Install and build
|
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
- name: Run status checks
|
2021-09-02 17:26:29 +00:00
|
|
|
id: status_check
|
|
|
|
run: |
|
|
|
|
output=$(node ./status-checks)
|
|
|
|
# Escape newlines so _all_ the output is included in the set-output
|
|
|
|
output="${output//'%'/'%25'}"
|
|
|
|
output="${output//$'\n'/'%0A'}"
|
|
|
|
output="${output//$'\r'/'%0D'}"
|
|
|
|
echo "::set-output name=status_check_output::$output"
|
2021-09-02 07:30:48 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-02 17:26:29 +00:00
|
|
|
- name: Auto Comment Status Check Result
|
|
|
|
# Use with caution
|
|
|
|
uses: bubkoo/auto-comment@v1
|
|
|
|
with:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-09-02 18:01:58 +00:00
|
|
|
pullRequestSynchronize: "${{ steps.status_check.outputs.status_check_output }}"
|
|
|
|
pullRequestAssigned: "${{ steps.status_check.outputs.status_check_output }}"
|
|
|
|
pullRequestOpened: "${{ steps.status_check.outputs.status_check_output }}"
|
|
|
|
pullRequestReopened: "${{ steps.status_check.outputs.status_check_output }}"
|