41 lines
1.4 KiB
YAML
41 lines
1.4 KiB
YAML
|
name: TypeScript Build Check
|
||
|
|
||
|
on: pull_request
|
||
|
|
||
|
jobs:
|
||
|
ts-build-check:
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Checkout Pull Request
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
ref: ${{github.event.pull_request.head.ref}}
|
||
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||
|
path: original-pr
|
||
|
- name: Setup Node
|
||
|
uses: actions/setup-node@v1
|
||
|
with:
|
||
|
node-version: 12.x
|
||
|
- name: Clone and Build Pull Request
|
||
|
run: |
|
||
|
cp $GITHUB_WORKSPACE/original-pr/ $GITHUB_WORKSPACE/built-pr -r
|
||
|
cd $GITHUB_WORKSPACE/built-pr/
|
||
|
npm i
|
||
|
npm run build
|
||
|
- name: Compare Built Directories
|
||
|
id: diff
|
||
|
run: |
|
||
|
DIFF=$(diff $GITHUB_WORKSPACE/original-pr/lib $GITHUB_WORKSPACE/built-pr/lib -rqiEZbwBd)
|
||
|
if [ "$DIFF" != "" ]; then exit 1; else echo -e "PR contains up-to-date compiled JavaScript."; fi
|
||
|
- name: Comment Unbuilt TypeScript
|
||
|
if: failure() && steps.diff.outcome == 'failure'
|
||
|
uses: actions/github-script@v2
|
||
|
with:
|
||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||
|
script: |
|
||
|
github.issues.createComment({
|
||
|
issue_number: ${{ github.event.number }},
|
||
|
owner: context.repo.owner,
|
||
|
repo: context.repo.repo,
|
||
|
body: 'Please compile the TypeScript code with `npm run build`. The compiled JavaScript is not up-to-date.'
|
||
|
})
|