Skip to content

Commit

Permalink
Merge pull request #3492 from bdach/github-actions
Browse files Browse the repository at this point in the history
Add GitHub Actions workflow
  • Loading branch information
cl8n authored May 4, 2020
2 parents 49b52bc + adefb0a commit 081cdfb
Show file tree
Hide file tree
Showing 4 changed files with 1,893 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: osu-wiki continuous integration

on:
pull_request:
branches:
- master

jobs:
ci:
name: remarkjs, changed files
runs-on: ubuntu-latest
steps:
- name: sparse checkout
shell: bash
run: |
# repository url, utilising provided github credentials
REPOSITORY="https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git"
# merge commit ref name (with refs/heads/ stripped out)
BRANCH="${GITHUB_REF/#refs\/heads\//}"
git version
# clone without blobs; don't checkout to avoid fetching them anyway
git clone --filter=blob:none --no-checkout ${REPOSITORY} .
git config --local gc.auto 0
# set up sparse checkout
git sparse-checkout init
git sparse-checkout set '**/*.md' '**/.remark*' '**/*.json'
# fetch the merge commit ref
git -c protocol.version=2 fetch --no-tags --prune --progress --depth=2 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH}
git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH
- name: setup node
uses: actions/setup-node@v1

- name: audit dependencies
run: npm audit

- name: install remark
run: npm install

- name: run remark on changed files
# stdout is discarded (remark prints files being checked there)
run: git diff ${{ github.sha }}^ ${{ github.sha }} --name-only '*.md' | xargs npx remark -qf --no-stdout --report=vfile-reporter-position --color
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# prevent accidental addition of files from local remark runs
node_modules/
Loading

0 comments on commit 081cdfb

Please sign in to comment.