mirror of
https://github.com/SrIzan10/osu-wiki.git
synced 2026-05-01 10:55:16 +00:00
94 lines
3.3 KiB
YAML
94 lines
3.3 KiB
YAML
name: osu-wiki continuous integration
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- edited
|
|
|
|
jobs:
|
|
ci:
|
|
name: 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' '**/*.yaml' 'scripts' 'wiki/**/*'
|
|
|
|
# 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: inspect binary file sizes
|
|
shell: bash
|
|
run: bash scripts/ci/inspect_binary_file_sizes.sh ${{ github.sha }} ${{ github.sha }}
|
|
- name: set up node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: install remark
|
|
run: npm install
|
|
|
|
- name: run remark on changed files
|
|
run: bash scripts/ci/run_remark.sh ${{ github.sha }} ${{ github.sha }}
|
|
|
|
- name: set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: "3.x"
|
|
|
|
- name: set up CI dependencies
|
|
run: |
|
|
pip install -r scripts/requirements.txt
|
|
|
|
- name: run yamllint on .yaml and .md files
|
|
run: |
|
|
python scripts/ci/run_yamllint.py --config .yamllint.yaml
|
|
|
|
- name: find broken wikilinks
|
|
shell: bash
|
|
env:
|
|
PULL_REQUEST_TAG: 'SKIP_WIKILINK_CHECK'
|
|
run: |
|
|
if ${{ contains(github.event.pull_request.body, env.PULL_REQUEST_TAG) }}; then
|
|
echo "::notice::Broken wikilink check suppressed ($PULL_REQUEST_TAG tag found in the pull request)"
|
|
exit 0
|
|
fi
|
|
|
|
ARTICLES=$( git diff --diff-filter=d --name-only ${{ github.sha }}^ ${{ github.sha }} "wiki/**/*.md" "news/*.md" )
|
|
find-broken-wikilinks --target $ARTICLES
|
|
|
|
- name: check if translations are marked as outdated
|
|
shell: bash
|
|
env:
|
|
PULL_REQUEST_TAG: 'SKIP_OUTDATED_CHECK'
|
|
run: |
|
|
if ${{ contains(github.event.pull_request.body, env.PULL_REQUEST_TAG) }}; then
|
|
echo "::notice::Outdated articles check suppressed ($PULL_REQUEST_TAG tag found in the pull request)"
|
|
exit 0
|
|
fi
|
|
# get the first commit of the branch associated with the PR; GitHub's ubuntu-latest has curl/jq: https://github.com/actions/virtual-environments
|
|
FIRST_PR_COMMIT_HASH=$( curl -sS ${{ github.event.pull_request.commits_url }}?per_page=1 | jq -r '.[0].sha' || true )
|
|
bash scripts/ci/check_outdated_tags.sh ${{ github.sha }} ${{ github.sha }} $FIRST_PR_COMMIT_HASH
|