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

Test CI step for detecting missing outdated: true markers #2

Closed
wants to merge 6 commits into from
Closed
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
67 changes: 67 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
pull_request:
branches:
- master
types:
- opened
- reopened
- synchronize
- edited

jobs:
ci:
Expand Down Expand Up @@ -78,3 +83,65 @@ jobs:
uses: ibiqlik/[email protected]
with:
config_file: .yamllint.yaml

- name: check if translations are marked as outdated
shell: bash
env:
MASK: '---\n(.*\n)*?((outdated: |outdated_since: ).+\n)(.*\n)*?---'
PULL_REQUEST_TAG: 'SKIP_OUTDATED_CHECK'
run: |
# https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit
function echo_red () { echo -e "\e[0;31m$1\e[m"; }
function echo_green () { echo -e "\e[0;32m$1\e[m"; }

function print_error () {
echo "::error::You have edited some original articles (en.md), but did not outdate their translations:"
while read FILENAME; do
echo_red "* $FILENAME"
done <<< "$1"

echo -e "\nIf your changes DON'T NEED to be added to the translations, add $( echo_red $PULL_REQUEST_TAG ) to the pull request."
echo -e "Otherwise, add the following to each article's front matter:\n"
echo_green "---"
echo_green "outdated: true"
if [[ -n "$2" ]]; then
echo_green "outdated_since: $2"
fi
echo_green "---"
}

function diff_files () { git diff --diff-filter=d --name-only ${{ github.sha }}^ ${{ github.sha }} "$@"; }

TRANSLATIONS=$( diff_files 'wiki/**/*.md' ':(exclude)*/en.md' )
ORIGINAL_ARTICLES=$( diff_files 'wiki/**/en.md' )
if [[ -z "$ORIGINAL_ARTICLES" ]]; then
echo "::notice::No original articles are edited, exiting"
exit 0
fi
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

# obtain directories of the modified en.md files, then list translations in them which:
# - are not modified in the PR (assuming that the author took care of them)
# - don't have the outdated/outdated_since markers

MISSED_TRANSLATIONS=$( echo "$ORIGINAL_ARTICLES" | xargs dirname | sort -u | {
while read DIRECTORY; do
for ARTICLE_NAME in $( ls "$DIRECTORY"/*.md | grep -v en.md || true ); do
if ! [[ "$TRANSLATIONS" =~ "$ARTICLE_NAME" ]]; then
grep -LzP -e "$MASK" "$ARTICLE_NAME" || true # print only names of non-matching files, with multiline match (considering \n)
fi
done
done
})

if [[ -n "$MISSED_TRANSLATIONS" ]]; then
# 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_COMMIT_HASH=$( curl -sS ${{ github.event.pull_request.commits_url }}?per_page=1 | jq -r '.[0].sha' || true )
print_error "$MISSED_TRANSLATIONS" "$FIRST_COMMIT_HASH"
exit 1
else
echo -e "::notice::Either you have edited no original articles, or all translations are properly outdated"
fi
2 changes: 2 additions & 0 deletions wiki/Beatmap/Difficulty/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ tags:

# Difficulty

<!-- something -->

*Not to be confused with [Beatmap](/wiki/Beatmap).*

A beatmap's **difficulty** is a game level, which is stored as a text file with [the `.osu` extension](/wiki/osu!_File_Formats/Osu_(file_format)). It consists of [hit objects](/wiki/Hit_object) of a certain [game mode](/wiki/Game_mode), which are set up accordingly to the [timing](/wiki/Beatmapping/Timing_section) tailored to a specific song. Difficulties have different aspects, which directly affect user experience. The difficulty name and [star rating](/wiki/Beatmapping/Star_rating) usually give enough information to tell how challenging it is.
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/Difficulty/fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ tags:

# Difficulté

<!-- some fake edit -->

*À ne pas confondre avec [Beatmap](/wiki/Beatmap).*

La **difficulté** d'une beatmap est un niveau de jeu, qui est stocké dans un fichier texte avec [l'extension `.osu`](/wiki/osu!_File_Formats/Osu_(file_format)). Il est composé d'[objets](/wiki/Hit_object) d'un certain [mode de jeu](/wiki/Game_mode), qui sont configurés en fonction du [timing](/wiki/Beatmapping/Timing_section) adapté à une musique spécifique. Les difficultés présentent différents aspects, qui affectent directement l'expérience de l'utilisateur. Le nom de la difficulté et le [classement en étoiles](/wiki/Beatmapping/Star_rating) donnent généralement suffisamment d'informations pour déterminer le niveau de difficulté.
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/Difficulty/id.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ tags:

*Berbeda konteks dengan [Beatmap](/wiki/Beatmap).*

<!-- some fake edit -->

Sebuah **tingkat kesulitan beatmap** adalah sebuah level permainan yang tersimpan dalam bentuk teks di sebuah file dengan [ekstensi `.osu`](/wiki/osu!_File_Formats/Osu_(file_format)). Masing-masing level berisikan [*hit object*](/wiki/Hit_object) berdasarkan [mode permainan](/wiki/Game_mode) terkait yang diatur sesuai dengan [waktu (*timing*)](/wiki/Beatmapping/Timing_section) yang telah ditentukan. Masing-masing tingkat kesulitan memiliki aspek yang berbeda, yang secara langsung dapat memengaruhi pengalaman pemain. Nama dari sebuah tingkat kesulitan dan [*star rating*](/wiki/Beatmapping/Star_rating) biasanya memberikan cukup informasi bagi pemain, apakah ini menantang atau tidak.

*Hit object* dari sebuah tingkat kesulitan disusun dalam sebuah [pola](/wiki/Beatmap/Pattern) yang bervariasi pada masing-masing mode permainan dan diatur sesuai dengan nada sehingga mewakili tampilan dan perasaan secara keseluruhan saat sedang dimainkan. Permainan dari sebuah tingkat kesulitan beatmap juga dapat diubah melalui [pengaturan kesulitan](/wiki/Beatmap_Editor/Song_Setup#difficulty) yang diatur oleh pemilik beatmap atau diubah dengan menggunakan [*game modifier*](/wiki/Game_modifier).
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/Difficulty/ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ tags:

# Сложность

<!-- some fake edit -->

*Эта статья — про отдельный компонент карты. Про набор сложностей рассказывается в статье [Карта](/wiki/Beatmap).*

**Сложность** карты — это игровой уровень, хранящийся в текстовом файле [формата `.osu`](/wiki/osu!_File_Formats/Osu_(file_format)). Он состоит из [объектов](/wiki/Hit_object), относящихся к отдельному [режиму игры](/wiki/Game_mode) и расположенных в соответствии с [таймингом](/wiki/Beatmapping/Timing_section) песни. У сложности есть несколько компонентов, влияющих на игровой процесс. По её названию и числу [звёзд](/wiki/Beatmapping/Star_rating) обычно можно определить требуемый уровень навыков.
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ tags:

# Beatmap

<!-- I am a forgetful editor, and I have just overlooked the translations! Oops! -->

A **beatmap** (sometimes called *beatmapset*) is a set of game levels ([difficulties](#difficulty)) that are composed of various [hit objects](/wiki/Hit_object) and almost always represent a single song. It also includes other components, all packed in an archive with [the `.osz` extension](/wiki/osu!_File_Formats/Osz_(file_format)):

- the song itself, stored in MP3 or Ogg format.
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
tags:
- mapset
- beatmapset
outdated: true
outdated_since: 5f491d0f3caeada5204b5d6354200ebc29456821
---

# Beatmap
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/id.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
tags:
- mapset
- beatmapset
outdated: true
outdated_since: 5f491d0f3caeada5204b5d6354200ebc29456821
---

# Beatmap
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ tags:
- mapas
- beatmapa
no_native_review: true
outdated: true
outdated_since: 5f491d0f3caeada5204b5d6354200ebc29456821
---

# Beatmap
Expand Down
2 changes: 2 additions & 0 deletions wiki/Beatmap/ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ tags:
- мапа
- мапсет
- битмапа
outdated: true
outdated_since: 5f491d0f3caeada5204b5d6354200ebc29456821
---

# Карта
Expand Down
2 changes: 2 additions & 0 deletions wiki/osu!_wiki/Maintenance/en.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# osu! wiki maintenance

<!-- update something else -->

*See also: [osu! wiki contribution guide](/wiki/osu!_wiki/Contribution_guide)*

This article describes technical or administrative aspects of the osu! wiki. It also covers maintenance procedures, which are required to keep it fresh—perhaps you may [help with one of them](#routines). For all discussions related to the wiki, use the `#osu-wiki` channel of the [osu!dev Discord server](/wiki/osu!dev_Discord_server).
Expand Down