Skip to content

Update rank 1 player in osu! rankings history #61173

Update rank 1 player in osu! rankings history

Update rank 1 player in osu! rankings history #61173

name: osu-wiki continuous integration
on:
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- edited
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
precondition:
name: Determine if CI should run
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
should_run_checks: ${{ steps.calc.outputs.should_run_checks }}
steps:
- name: Determine if CI should run
id: calc
uses: actions/github-script@v6
with:
script: |
const action = context.payload.action;
if (action != 'edited') {
core.setOutput('should_run_checks', 'true');
console.log('PR status or contents have changed => will run checks');
return;
}
const FLAGS = ['SKIP_REMARK', 'SKIP_WIKILINK_CHECK'];
const oldBody = context.payload.changes?.body?.from || '';
const newBody = context.payload.pull_request?.body || '';
const hasChangedFlags = FLAGS.some(flag => oldBody.includes(flag) != newBody.includes(flag));
if (hasChangedFlags) {
console.log('PR flags have changed => will run checks');
core.setOutput('should_run_checks', 'true');
return;
}
// Only previously successful checks must be skipped. It is possible for a check to fail due to
// infrastructure issues or the contents of the PR; in this case, it must run as per usual instead of
// masking the error even if the flags haven't changed.
const { owner, repo } = context.repo;
const { data: thisRun } = await github.rest.actions.getWorkflowRun({
owner, repo, run_id: context.runId,
});
const { data } = await github.rest.actions.listWorkflowRuns({
owner, repo,
workflow_id: thisRun.workflow_id,
head_sha: context.payload.pull_request.head.sha,
status: 'completed',
});
const previous = data.workflow_runs.find(run => run.id !== context.runId);
console.info(
'Previous workflow run for this commit: ' + JSON.stringify(previous?.url) +
', conclusion: ' + JSON.stringify(previous?.conclusion)
);
const isFailureOrUnknown = previous?.conclusion !== 'success';
core.setOutput('should_run_checks', String(isFailureOrUnknown));
ci:
name: changed files
needs: precondition
if: ${{ needs.precondition.outputs.should_run_checks == 'true' }}
runs-on: ubuntu-latest
steps:
# Clone the repo and only fetch the commit that triggered the workflow (omitted default of `fetch-depth: 1`).
# To get the full list of changed files and avoid `fetch-depth: 0` (fetches the whole history) or GitHub API
# (returns <=3,000 changed files), we manually fetch `master` later.
- uses: actions/checkout@v4
- name: set up Node.js
id: setup-node
uses: actions/setup-node@v4
with:
cache: npm
node-version: 20
- name: load node_modules from cache
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}-${{ steps.setup-node.outputs.node-version }}
- name: "if cache is outdated: install node.js dependencies"
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
run: npm ci
- name: Install package manager (Python)
uses: astral-sh/setup-uv@v7
- name: Install dependencies (Python)
run: uv sync
- name: detect changed files
id: detect-changed-files
# Use NUL as a separator to prevent filenames containing spaces and punctuation marks from tripping up the scripts.
run: |
changed_files="$(mktemp)"
git fetch --no-tags --depth=1 origin master
git diff --diff-filter=d --name-only --no-renames -z origin/master HEAD > "$changed_files"
printf 'CHANGED_FILES=%s\n' "$changed_files" >>"$GITHUB_ENV"
- name: check file sizes
if: ${{ !cancelled() && steps.detect-changed-files.outcome == 'success' }}
run: xargs -0r meta/check-file-sizes.sh <"$CHANGED_FILES"
- name: run remark on changed files
if: ${{ !cancelled() && steps.detect-changed-files.outcome == 'success' }}
continue-on-error: ${{ contains(github.event.pull_request.body, 'SKIP_REMARK') }}
run: |
grep -z '\.md$' <"$CHANGED_FILES" | \
REPORTER=vfile-reporter-github-action xargs -0r meta/remark.sh
- name: run yamllint on .yaml and .md files
if: ${{ !cancelled() && steps.detect-changed-files.outcome == 'success' }}
run: uv tool run osu-wiki-tools check-yaml --format github
- name: find broken wikilinks
if: ${{ !cancelled() && steps.detect-changed-files.outcome == 'success' }}
continue-on-error: ${{ contains(github.event.pull_request.body, 'SKIP_WIKILINK_CHECK') }}
run: uv tool run osu-wiki-tools check-links --all --format github