Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Actions workflow #3492

Merged
merged 6 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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