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 3 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
42 changes: 42 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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: 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# prevent accidental addition of files from local remark runs
node_modules/
package-lock.json
cl8n marked this conversation as resolved.
Show resolved Hide resolved
39 changes: 39 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "osu-wiki",
"description": "home of the osu! wiki",
"repository": "github:ppy/osu-wiki",
"dependencies": {
"remark-cli": "latest",
"remark": "latest",
"remark-preset-lint-markdown-style-guide": "latest",
"remark-frontmatter": "latest",
"remark-lint-definition-case": "latest",
"remark-lint-fenced-code-flag": "latest",
"remark-lint-final-definition": "latest",
"remark-lint-final-newline": "latest",
"remark-lint-list-item-indent": "latest",
"remark-lint-list-item-spacing": "latest",
"remark-lint-maximum-heading-length": "latest",
"remark-lint-maximum-line-length": "latest",
"remark-lint-no-duplicate-definitions": "latest",
"remark-lint-no-duplicate-headings": "latest",
"remark-lint-no-duplicate-headings-in-section": "latest",
"remark-lint-no-emphasis-as-heading": "latest",
"remark-lint-no-file-name-articles": "latest",
"remark-lint-no-file-name-consecutive-dashes": "latest",
"remark-lint-no-file-name-irregular-characters": "latest",
"remark-lint-no-file-name-mixed-case": "latest",
"remark-lint-no-heading-content-indent": "latest",
"remark-lint-no-heading-indent": "latest",
"remark-lint-no-heading-like-paragraph": "latest",
"remark-lint-no-html": "latest",
"remark-lint-no-missing-blank-lines": "latest",
"remark-lint-no-shortcut-reference-link": "latest",
"remark-lint-no-tabs": "latest",
"remark-lint-no-undefined-references": "latest",
"remark-lint-no-unused-definitions": "latest",
"remark-lint-ordered-list-marker-value": "latest",
"remark-lint-table-pipe-alignment": "latest",
"vfile-reporter-position": "latest"
cl8n marked this conversation as resolved.
Show resolved Hide resolved
}
}