feat: add checker

This commit is contained in:
bestony 2021-01-15 11:35:04 +08:00
parent e7a6908ae1
commit ee687f80e5

View File

@ -0,0 +1,53 @@
name: LCTT Article Checker
on:
push:
branches: [master]
# pull_request:
# branches: [ master ]
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_BRANCH: master
TRAVIS_PULL_REQUEST: ${{ github.event.number }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Set ENV variables
run: |
echo "::set-env name=TRAVIS_BRANCH::${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}"
echo "::set-env name=TRAVIS_EVENT_TYPE::$(if [ "schedule" == "${{ github.event_name }}" ]; then echo "cron"; else echo "${{ github.event_name }}"; fi)"
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: gh-pages
path: build
- name: Install JQ
run: sudo apt install jq -y
- name: run check
if: ${{ github.event_name == 'pull_request' }}
run: sh ./scripts/check.sh;
- name: run badge
if: ${{ github.event_name != 'pull_request' }}
run: sh ./scripts/badge.sh;
- name: run status
if: ${{ github.event_name == 'schedule' }}
run: sh ./scripts/status.sh;
- uses: crazy-max/ghaction-github-pages@v2.2.0
with:
keep_history: true
build_dir: ${{github.repository}}/build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}