mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00

By default actions/checkout@v2 only checks out the latest commit of the current branch. Unfortunately, this causes the `git diff` check in `check-pr.sh` to fail, as `master` branch isn't available`. This change checks out all commits of all branches, which allows `git diff` to work correctly. Ideally, I'd like to use the `ref` setting of actions/checkout@v2, but that only supports a single ref so it's not possible to checkout the PR branch _and_ `master` branch at the same time.
35 lines
687 B
YAML
35 lines
687 B
YAML
name: CI
|
|
|
|
on: ['push', 'pull_request']
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
|
|
name: CI
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up PR environment
|
|
if: github.event.number != null
|
|
run: echo "::set-env name=PULL_REQUEST_ID::${{ github.event.number }}"
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
|
|
- name: Test
|
|
run: npm test
|
|
|
|
- name: Build
|
|
run: bash scripts/build.sh
|
|
|
|
- name: Deploy
|
|
if: github.repository == 'tldr-pages/tldr' && github.ref == 'refs/heads/master'
|
|
run: bash scripts/deploy.sh
|
|
env:
|
|
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|