mapcomplete/.github/workflows/pull_request_check.yml

65 lines
1.8 KiB
YAML
Raw Normal View History

2021-04-10 13:01:28 +00:00
name: Pull request check
on:
2021-04-11 00:49:51 +00:00
pull_request_target:
2021-04-10 13:01:28 +00:00
types: [opened, edited, synchronize, ready_for_review, review_requested]
2021-04-11 00:40:46 +00:00
2021-04-10 13:01:28 +00:00
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1.2.0
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: install deps
run: npm install
- name: create generated dir
run: mkdir ./assets/generated
- name: create stub themes
run: "echo '{\"layers\": [], \"themes\": []}' > ./assets/generated/known_layers_and_themes.json"
2021-04-10 14:18:29 +00:00
- name: Compile license info
2021-04-10 14:20:40 +00:00
run: npm run generate:licenses
2021-04-10 13:01:28 +00:00
2021-04-10 14:18:29 +00:00
- name: Compile and validate themes and layers
2021-04-10 14:06:01 +00:00
run: npm run validate:layeroverview
2021-04-10 14:20:40 +00:00
- name: Validate license info
run: npm run validate:licenses
2021-04-11 00:49:51 +00:00
- name: Set failure key
run: |
2021-04-11 01:17:59 +00:00
ls
2021-04-11 00:49:51 +00:00
if [[ -f "layer_report.txt" || -f "missing_licenses.txt" ]]; then
2021-04-11 01:17:59 +00:00
echo "Found a report..."
2021-04-11 00:57:34 +00:00
echo "VALIDATION_FAILED=true" >> $GITHUB_ENV
else
echo "VALIDATION_FAILED=false" >> $GITHUB_ENV
2021-04-11 00:49:51 +00:00
fi
- name: Test variable
run: echo "${{ env.VALIDATION_FAILED }}"
2021-04-11 00:53:53 +00:00
- name: Archive reports
uses: actions/upload-artifact@v2
if: >-
env.VALIDATION_FAILED == 'true'
with:
name: reports
path: |
layer_report.txt
missing_licenses.txt
2021-04-11 00:49:51 +00:00
- name: Comment PR
uses: allthatjazzleo/actions-pull-request-add-comment@master
if: >-
env.VALIDATION_FAILED == 'true'
with:
message: "cat layer_report.txt missing_licenses.txt"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}