From 1f11b0a8c8eab6f65779433b7f2b583ab6084aad Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:16:15 +0200 Subject: [PATCH 01/38] Add check for existence of issue.md. Split consistency check and issue creation into 2 separate steps. --- .../workflows/i18n-consistency-checker.yaml | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 4b7a5f6b2..4d467e007 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' - - name: Check consistency and create issue + - name: Check consistency id: check-consistency run: | # Declare the flags @@ -28,15 +28,6 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" - # Heredoc for issue header - cat <<- EOM > issue.md - # i18n Contents Consistency Issue - - The following files may have consistency issues with the English version. Please check and update the files. - - This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. - EOM - # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 @@ -72,18 +63,41 @@ jobs: EOM fi done + + - name: Check issue.md existence + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: "issue.md" + - name: File exists + if: steps.check_files.outputs.files_exists == 'true' + # Only runs if all of the files exists + run: echo issue.md exists. should create/update issue now. + + # - if: ${{ env.MARKDOWN_FILES != '' }} + # name: Create issue + # run: | + # # Heredoc for issue header + # cat <<- EOM > issue.md + # # i18n Contents Consistency Issue - # Get the existing issue ID - existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) - echo "existing_issue_id: $existing_issue_id" - # Create a new issue or comment on the existing one - if [ -f issue.md ]; then - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi - fi + # The following files may have consistency issues with the English version. Please check and update the files. + + # This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. + # EOM + + # # Get the existing issue ID + # existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + # echo "existing_issue_id: $existing_issue_id" + # # Create a new issue or comment on the existing one + # if [ -f issue.md ]; then + # if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + # gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY + # else + # gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" + # fi + # fi + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 3c3bc3daaa295e2ee1bcde02be2d89797e622591 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:20:11 +0200 Subject: [PATCH 02/38] Fix YAML syntax --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 4d467e007..c15035aa5 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -64,7 +64,7 @@ jobs: fi done - - name: Check issue.md existence + - name: Check issue.md existence id: check_files uses: andstor/file-existence-action@v2 with: From d108c7bb15e8b541db91702dde6425d350c8abf3 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:27:32 +0200 Subject: [PATCH 03/38] Simulate creation of issue.md (only for Japanese) --- .github/workflows/i18n-consistency-checker.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index c15035aa5..97961c290 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -36,6 +36,10 @@ jobs: if [[ ! -e "$i18n_filename" ]]; then continue fi + + if [[ ${{matrix.language}} == "ja" ]] + cat "test content" >> issue.md + fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) @@ -69,7 +73,7 @@ jobs: uses: andstor/file-existence-action@v2 with: files: "issue.md" - - name: File exists + - name: Create issue if: steps.check_files.outputs.files_exists == 'true' # Only runs if all of the files exists run: echo issue.md exists. should create/update issue now. From da92975e8c743f2ad73d16edcced962cc842493c Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:28:58 +0200 Subject: [PATCH 04/38] Fix bash syntax --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 97961c290..e2361070e 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -37,7 +37,7 @@ jobs: continue fi - if [[ ${{matrix.language}} == "ja" ]] + if [[ ${{matrix.language}} == "ja" ]]; then cat "test content" >> issue.md fi From a2ba3f11dd4f0f57a8f62b7a3d524bac53dfda75 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:31:05 +0200 Subject: [PATCH 05/38] Fix file creation --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index e2361070e..9249ca5c1 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -38,7 +38,7 @@ jobs: fi if [[ ${{matrix.language}} == "ja" ]]; then - cat "test content" >> issue.md + echo "test content" >> issue.md fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) From 2b432ec0a8bb35482e9fb6148b59c082057831e4 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:32:44 +0200 Subject: [PATCH 06/38] Remove simulation code --- .github/workflows/i18n-consistency-checker.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 9249ca5c1..03a9337da 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -36,10 +36,6 @@ jobs: if [[ ! -e "$i18n_filename" ]]; then continue fi - - if [[ ${{matrix.language}} == "ja" ]]; then - echo "test content" >> issue.md - fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) From 743c384f0fd235ecbdc320ecf0c224e4ade9eaba Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:37:03 +0200 Subject: [PATCH 07/38] Combine header for issue, with details about the i18n inconsistencies found during previous steps. --- .../workflows/i18n-consistency-checker.yaml | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 03a9337da..96ff060b2 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -74,29 +74,32 @@ jobs: # Only runs if all of the files exists run: echo issue.md exists. should create/update issue now. - # - if: ${{ env.MARKDOWN_FILES != '' }} - # name: Create issue - # run: | - # # Heredoc for issue header - # cat <<- EOM > issue.md - # # i18n Contents Consistency Issue + - if: ${{ env.MARKDOWN_FILES != '' }} + name: Create issue + run: | + # Heredoc for issue header + cat <<- EOM > issue-full.md + # i18n Contents Consistency Issue - # The following files may have consistency issues with the English version. Please check and update the files. + The following files may have consistency issues with the English version. Please check and update the files. - # This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. - # EOM + This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. + EOM + + # combine header and rest of file created in previous steps + cat issue.md >> issue-full.md - # # Get the existing issue ID - # existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) - # echo "existing_issue_id: $existing_issue_id" - # # Create a new issue or comment on the existing one - # if [ -f issue.md ]; then - # if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - # gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - # else - # gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - # fi - # fi + # Get the existing issue ID + existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + echo "existing_issue_id: $existing_issue_id" + # Create a new issue or comment on the existing one + if [ -f issue.md ]; then + if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY + else + gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" + fi + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d3c7b1526191230ecb6514ec391fa0fa6b3267bf Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:38:30 +0200 Subject: [PATCH 08/38] Move issue_title variable to the correct step --- .github/workflows/i18n-consistency-checker.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 96ff060b2..8152038d4 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -26,8 +26,6 @@ jobs: # Declare the flags declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese") - issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" - # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 @@ -89,6 +87,9 @@ jobs: # combine header and rest of file created in previous steps cat issue.md >> issue-full.md + # title of the GitHub issue to look for + issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" + # Get the existing issue ID existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) echo "existing_issue_id: $existing_issue_id" From 7e8f7cacc4b8a59cf2c4ef1a70d382ef3a133730 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:38:50 +0200 Subject: [PATCH 09/38] Remove dummy step --- .github/workflows/i18n-consistency-checker.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 8152038d4..6ea613960 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -69,11 +69,6 @@ jobs: files: "issue.md" - name: Create issue if: steps.check_files.outputs.files_exists == 'true' - # Only runs if all of the files exists - run: echo issue.md exists. should create/update issue now. - - - if: ${{ env.MARKDOWN_FILES != '' }} - name: Create issue run: | # Heredoc for issue header cat <<- EOM > issue-full.md From be6894602b785f6294d06bda588f0d339981b42e Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:41:45 +0200 Subject: [PATCH 10/38] No need to check for issue.md existence within the shell script, as we already check that in a previous workflow step --- .github/workflows/i18n-consistency-checker.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 6ea613960..526f5e91f 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -88,13 +88,12 @@ jobs: # Get the existing issue ID existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) echo "existing_issue_id: $existing_issue_id" + # Create a new issue or comment on the existing one - if [ -f issue.md ]; then - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi + if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY + else + gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" fi env: From cc36c63f0ef067193fb32da2e4ee4fe6b71b488c Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:26:53 +0100 Subject: [PATCH 11/38] Change the search query that identifies the issue to write the data to. Don't wrote anything yet. --- .github/workflows/i18n-consistency-checker.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 526f5e91f..d4d68d27a 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -86,15 +86,15 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" # Get the existing issue ID - existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + existing_issue_id=$(gh issue list -S "is:issue is:open in:title '$issue_title'" | cut -f1) echo "existing_issue_id: $existing_issue_id" # Create a new issue or comment on the existing one - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi + #if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + # gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY + #else + # gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" + #fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 468542825e34af1775d853fb10985695692f0e2f Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:42:19 +0100 Subject: [PATCH 12/38] Add some debug output --- .github/workflows/i18n-consistency-checker.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index d4d68d27a..64cea817a 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -28,6 +28,7 @@ jobs: # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do + echo "Checking file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g") @@ -39,6 +40,7 @@ jobs: i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) if [[ $((original_updated_at - i18n_content_updated_at)) -ge 1 ]]; then + echo "\t:x: translation inconsistencies found" content_header=$(grep -E '^title+' "$file" | sort -r | head -n1) content_title=$(echo "$content_header" | sed 's/title: //g') @@ -59,7 +61,10 @@ jobs: \`\`\` EOM + else + echo ":white_check_mark: No translation inconsistencies found" fi + done - name: Check issue.md existence From 61c178f00bf2f32da75dd1d4575d3e0e1965fe19 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:49:51 +0100 Subject: [PATCH 13/38] More debug output. test on the other languages too --- .github/workflows/i18n-consistency-checker.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 64cea817a..52fca1767 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - language: [ja, zh] + language: [ja, zh, pt-br, gl] steps: - uses: actions/checkout@v3 with: @@ -24,15 +24,17 @@ jobs: id: check-consistency run: | # Declare the flags - declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese") + declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese" ["pt-br"]=":brazil: Brazilian Portuguese" ["gl"]="Galician" ) # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do - echo "Checking file: $file" + echo "Original file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g") - + echo "Translation file: $i18n_filename" + if [[ ! -e "$i18n_filename" ]]; then + echo "\t:?: File not translated yet" continue fi @@ -62,7 +64,7 @@ jobs: EOM else - echo ":white_check_mark: No translation inconsistencies found" + echo "\t:white_check_mark: No translation inconsistencies found" fi done From 7f3ddaf8439a5104390b67feffba865a3abba9f3 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:16:15 +0200 Subject: [PATCH 14/38] Add check for existence of issue.md. Split consistency check and issue creation into 2 separate steps. --- .../workflows/i18n-consistency-checker.yaml | 56 ++++++++++++------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index e0084b4a2..7ebe83f6d 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: '0' - - name: Check consistency and create issue + - name: Check consistency id: check-consistency run: | # Declare the flags @@ -28,15 +28,6 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" - # Heredoc for issue header - cat <<- EOM > issue.md - # i18n Contents Consistency Issue - - The following files may have consistency issues with the English version. Please check and update the files. - - This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. - EOM - # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 @@ -72,18 +63,41 @@ jobs: EOM fi done + + - name: Check issue.md existence + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: "issue.md" + - name: File exists + if: steps.check_files.outputs.files_exists == 'true' + # Only runs if all of the files exists + run: echo issue.md exists. should create/update issue now. + + # - if: ${{ env.MARKDOWN_FILES != '' }} + # name: Create issue + # run: | + # # Heredoc for issue header + # cat <<- EOM > issue.md + # # i18n Contents Consistency Issue - # Get the existing issue ID - existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) - echo "existing_issue_id: $existing_issue_id" - # Create a new issue or comment on the existing one - if [ -f issue.md ]; then - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi - fi + # The following files may have consistency issues with the English version. Please check and update the files. + + # This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. + # EOM + + # # Get the existing issue ID + # existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + # echo "existing_issue_id: $existing_issue_id" + # # Create a new issue or comment on the existing one + # if [ -f issue.md ]; then + # if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + # gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY + # else + # gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" + # fi + # fi + env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 0ea4033dec3508d0ed847c544dd4514b79a40516 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:20:11 +0200 Subject: [PATCH 15/38] Fix YAML syntax --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 7ebe83f6d..d727e44c2 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -64,7 +64,7 @@ jobs: fi done - - name: Check issue.md existence + - name: Check issue.md existence id: check_files uses: andstor/file-existence-action@v2 with: From 72cf2df92a95d067eb90abc88c6e98f04375d079 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:27:32 +0200 Subject: [PATCH 16/38] Simulate creation of issue.md (only for Japanese) --- .github/workflows/i18n-consistency-checker.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index d727e44c2..be76ec27c 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -36,6 +36,10 @@ jobs: if [[ ! -e "$i18n_filename" ]]; then continue fi + + if [[ ${{matrix.language}} == "ja" ]] + cat "test content" >> issue.md + fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) @@ -69,7 +73,7 @@ jobs: uses: andstor/file-existence-action@v2 with: files: "issue.md" - - name: File exists + - name: Create issue if: steps.check_files.outputs.files_exists == 'true' # Only runs if all of the files exists run: echo issue.md exists. should create/update issue now. From a52f65d6c1d41b22e5bdfb1f991b83aac3a3d1b5 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:28:58 +0200 Subject: [PATCH 17/38] Fix bash syntax --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index be76ec27c..6a34c3d47 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -37,7 +37,7 @@ jobs: continue fi - if [[ ${{matrix.language}} == "ja" ]] + if [[ ${{matrix.language}} == "ja" ]]; then cat "test content" >> issue.md fi From 70717f32f52125573cf288348917d2b6440ecadb Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:31:05 +0200 Subject: [PATCH 18/38] Fix file creation --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 6a34c3d47..4f85b1285 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -38,7 +38,7 @@ jobs: fi if [[ ${{matrix.language}} == "ja" ]]; then - cat "test content" >> issue.md + echo "test content" >> issue.md fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) From ce7c67763567fc2d86d1120a3e529a4a21226a68 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:32:44 +0200 Subject: [PATCH 19/38] Remove simulation code --- .github/workflows/i18n-consistency-checker.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 4f85b1285..04116693d 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -36,10 +36,6 @@ jobs: if [[ ! -e "$i18n_filename" ]]; then continue fi - - if [[ ${{matrix.language}} == "ja" ]]; then - echo "test content" >> issue.md - fi original_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $file)" +%s) i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) From 3f09f1e4ce7e597aa7c5684c7cb4ff5d90f35da4 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:37:03 +0200 Subject: [PATCH 20/38] Combine header for issue, with details about the i18n inconsistencies found during previous steps. --- .../workflows/i18n-consistency-checker.yaml | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 04116693d..eb56c4370 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -74,29 +74,32 @@ jobs: # Only runs if all of the files exists run: echo issue.md exists. should create/update issue now. - # - if: ${{ env.MARKDOWN_FILES != '' }} - # name: Create issue - # run: | - # # Heredoc for issue header - # cat <<- EOM > issue.md - # # i18n Contents Consistency Issue + - if: ${{ env.MARKDOWN_FILES != '' }} + name: Create issue + run: | + # Heredoc for issue header + cat <<- EOM > issue-full.md + # i18n Contents Consistency Issue - # The following files may have consistency issues with the English version. Please check and update the files. + The following files may have consistency issues with the English version. Please check and update the files. - # This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. - # EOM + This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. + EOM + + # combine header and rest of file created in previous steps + cat issue.md >> issue-full.md - # # Get the existing issue ID - # existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) - # echo "existing_issue_id: $existing_issue_id" - # # Create a new issue or comment on the existing one - # if [ -f issue.md ]; then - # if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - # gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - # else - # gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - # fi - # fi + # Get the existing issue ID + existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + echo "existing_issue_id: $existing_issue_id" + # Create a new issue or comment on the existing one + if [ -f issue.md ]; then + if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY + else + gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" + fi + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 52167a1b1651f82e466f4c03538e3ba9a19dbc66 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:38:30 +0200 Subject: [PATCH 21/38] Move issue_title variable to the correct step --- .github/workflows/i18n-consistency-checker.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index eb56c4370..d8d746275 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -26,8 +26,6 @@ jobs: # Declare the flags declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese" ["pt-br"]=":brazil: Brazilian Portuguese" ["gl"]="Galician") - issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" - # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 @@ -89,6 +87,9 @@ jobs: # combine header and rest of file created in previous steps cat issue.md >> issue-full.md + # title of the GitHub issue to look for + issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" + # Get the existing issue ID existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) echo "existing_issue_id: $existing_issue_id" From 8e0cd53e9de2ad161aa17817e7c9c881bfb44798 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:38:50 +0200 Subject: [PATCH 22/38] Remove dummy step --- .github/workflows/i18n-consistency-checker.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index d8d746275..78061a98c 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -69,11 +69,6 @@ jobs: files: "issue.md" - name: Create issue if: steps.check_files.outputs.files_exists == 'true' - # Only runs if all of the files exists - run: echo issue.md exists. should create/update issue now. - - - if: ${{ env.MARKDOWN_FILES != '' }} - name: Create issue run: | # Heredoc for issue header cat <<- EOM > issue-full.md From 22bff6208370e4658a966f56a04385e49652ba62 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Sep 2023 12:41:45 +0200 Subject: [PATCH 23/38] No need to check for issue.md existence within the shell script, as we already check that in a previous workflow step --- .github/workflows/i18n-consistency-checker.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 78061a98c..1f6bc1d31 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -88,13 +88,12 @@ jobs: # Get the existing issue ID existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) echo "existing_issue_id: $existing_issue_id" + # Create a new issue or comment on the existing one - if [ -f issue.md ]; then - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi + if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY + else + gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" fi env: From 9524620bbc14e7c012e3740e5faaa632641cae11 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:26:53 +0100 Subject: [PATCH 24/38] Change the search query that identifies the issue to write the data to. Don't wrote anything yet. --- .github/workflows/i18n-consistency-checker.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 1f6bc1d31..51099dfed 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -86,15 +86,15 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" # Get the existing issue ID - existing_issue_id=$(gh issue list -S "is:issue is:open $issue_title" | cut -f1) + existing_issue_id=$(gh issue list -S "is:issue is:open in:title '$issue_title'" | cut -f1) echo "existing_issue_id: $existing_issue_id" # Create a new issue or comment on the existing one - if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then - gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY - else - gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" - fi + #if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then + # gh issue comment "$existing_issue_id" -F issue-full.md -R $GITHUB_REPOSITORY + #else + # gh issue create -t "$issue_title" -F issue-full.md -R $GITHUB_REPOSITORY -l "Type - Translation" + #fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 746f34683fd2ff817a71beb89ef7782134bca51b Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:42:19 +0100 Subject: [PATCH 25/38] Add some debug output --- .github/workflows/i18n-consistency-checker.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 51099dfed..9c55be7dd 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -28,6 +28,7 @@ jobs: # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do + echo "Checking file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g") @@ -39,6 +40,7 @@ jobs: i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) if [[ $((original_updated_at - i18n_content_updated_at)) -ge 1 ]]; then + echo "\t:x: translation inconsistencies found" content_header=$(grep -E '^title+' "$file" | sort -r | head -n1) content_title=$(echo "$content_header" | sed 's/title: //g') @@ -59,7 +61,10 @@ jobs: \`\`\` EOM + else + echo ":white_check_mark: No translation inconsistencies found" fi + done - name: Check issue.md existence From 7a0870093425fec15bd785e6683edc551ba7a9ab Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 14:49:51 +0100 Subject: [PATCH 26/38] More debug output. test on the other languages too --- .github/workflows/i18n-consistency-checker.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 9c55be7dd..52fca1767 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -24,15 +24,17 @@ jobs: id: check-consistency run: | # Declare the flags - declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese" ["pt-br"]=":brazil: Brazilian Portuguese" ["gl"]="Galician") + declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese" ["pt-br"]=":brazil: Brazilian Portuguese" ["gl"]="Galician" ) # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do - echo "Checking file: $file" + echo "Original file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g") - + echo "Translation file: $i18n_filename" + if [[ ! -e "$i18n_filename" ]]; then + echo "\t:?: File not translated yet" continue fi @@ -62,7 +64,7 @@ jobs: EOM else - echo ":white_check_mark: No translation inconsistencies found" + echo "\t:white_check_mark: No translation inconsistencies found" fi done From 02365ec486fb5cc9b78086a767cb069fcdeb09c5 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 19:38:05 +0100 Subject: [PATCH 27/38] Make heredoc work --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 52fca1767..2e6d66239 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -84,7 +84,7 @@ jobs: The following files may have consistency issues with the English version. Please check and update the files. This issue is created when any of the English patterns have changed (in folder `patterns/`). It compares the git update history to let you know what updates are overdue. The issue should be closed when the update is complete. - EOM + EOM # combine header and rest of file created in previous steps cat issue.md >> issue-full.md From cd539b9ea07e621fa3e15b03c9c0eb84f30f76d1 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 20:15:11 +0100 Subject: [PATCH 28/38] Add more log messages --- .github/workflows/i18n-consistency-checker.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 2e6d66239..050e49ec2 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -93,7 +93,9 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" # Get the existing issue ID - existing_issue_id=$(gh issue list -S "is:issue is:open in:title '$issue_title'" | cut -f1) + search_query="is:issue is:open in:title '$issue_title'" + echo "search_query: $search_query" + existing_issue_id=$(gh issue list -S $search_query | cut -f1) echo "existing_issue_id: $existing_issue_id" # Create a new issue or comment on the existing one From 53eae7a8f0d72b0c5effed4a756cd3797a7f6430 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 20:18:52 +0100 Subject: [PATCH 29/38] Change quotes --- .github/workflows/i18n-consistency-checker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 050e49ec2..963d852fa 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -93,9 +93,9 @@ jobs: issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" # Get the existing issue ID - search_query="is:issue is:open in:title '$issue_title'" + search_query="is:issue is:open in:title \"$issue_title\"" echo "search_query: $search_query" - existing_issue_id=$(gh issue list -S $search_query | cut -f1) + existing_issue_id=$(gh issue list -S "$search_query" | cut -f1) echo "existing_issue_id: $existing_issue_id" # Create a new issue or comment on the existing one From f066ed86679be0f98236fa10a7770e54151e2f82 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 20:21:16 +0100 Subject: [PATCH 30/38] Change more quores --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 963d852fa..a2a85cf37 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -90,7 +90,7 @@ jobs: cat issue.md >> issue-full.md # title of the GitHub issue to look for - issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" + issue_title="${flags[\"${{matrix.language}}\"]}: Content Consistency Issue" # Get the existing issue ID search_query="is:issue is:open in:title \"$issue_title\"" From 41ed0bba567620d1bcad14ab68dfab09bc959866 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 20:23:31 +0100 Subject: [PATCH 31/38] Repeat flags --- .github/workflows/i18n-consistency-checker.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index a2a85cf37..62337d2bc 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -77,6 +77,9 @@ jobs: - name: Create issue if: steps.check_files.outputs.files_exists == 'true' run: | + # Declare the flags + declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese" ["pt-br"]=":brazil: Brazilian Portuguese" ["gl"]="Galician" ) + # Heredoc for issue header cat <<- EOM > issue-full.md # i18n Contents Consistency Issue @@ -90,7 +93,7 @@ jobs: cat issue.md >> issue-full.md # title of the GitHub issue to look for - issue_title="${flags[\"${{matrix.language}}\"]}: Content Consistency Issue" + issue_title="${flags['${{matrix.language}}']}: Content Consistency Issue" # Get the existing issue ID search_query="is:issue is:open in:title \"$issue_title\"" From 247da31a75a2f93901949477a5944428d48b8fdb Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 21:04:33 +0100 Subject: [PATCH 32/38] Change sed command to create translation filenames. Add different log output --- .github/workflows/i18n-consistency-checker.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 62337d2bc..57f5fa64a 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -30,7 +30,7 @@ jobs: for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do echo "Original file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 - i18n_filename=$(echo "$file" | sed "s/patterns\/\(2-structured\|3-validated\)/translation\/${{matrix.language}}\/patterns/g") + i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)(/project-setup)?_translation/${{matrix.language}}/patterns_g") echo "Translation file: $i18n_filename" if [[ ! -e "$i18n_filename" ]]; then @@ -42,7 +42,7 @@ jobs: i18n_content_updated_at=$(date -d "$(git log -1 --format=%cd --date=iso $i18n_filename)" +%s) if [[ $((original_updated_at - i18n_content_updated_at)) -ge 1 ]]; then - echo "\t:x: translation inconsistencies found" + echo "WARNING" content_header=$(grep -E '^title+' "$file" | sort -r | head -n1) content_title=$(echo "$content_header" | sed 's/title: //g') @@ -64,7 +64,7 @@ jobs: EOM else - echo "\t:white_check_mark: No translation inconsistencies found" + echo "CHECK" fi done From 2d0d04d038ff58000383bf785c9e67ae1c9f362a Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 21:18:56 +0100 Subject: [PATCH 33/38] Fix error log --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 57f5fa64a..493622976 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -34,7 +34,7 @@ jobs: echo "Translation file: $i18n_filename" if [[ ! -e "$i18n_filename" ]]; then - echo "\t:?: File not translated yet" + echo "NOT TRANSLATED" continue fi From 23a7611037c6ad34a6a969da9dc1fb3b47d1eb36 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Fri, 1 Dec 2023 22:08:30 +0100 Subject: [PATCH 34/38] Ignore all templates for now --- .github/workflows/i18n-consistency-checker.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 493622976..1caec622d 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -30,6 +30,7 @@ jobs: for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do echo "Original file: $file" [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 + [[ $file =~ "/templates" ]] && continue # if the file is under /templates, skip. consistency check does not work for that yet. i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)(/project-setup)?_translation/${{matrix.language}}/patterns_g") echo "Translation file: $i18n_filename" From 54b6c402e009c1d0efd660a649305077b0041705 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Sat, 2 Dec 2023 08:53:09 +0100 Subject: [PATCH 35/38] Limit search to a single result --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 1caec622d..6b6f39438 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -99,7 +99,7 @@ jobs: # Get the existing issue ID search_query="is:issue is:open in:title \"$issue_title\"" echo "search_query: $search_query" - existing_issue_id=$(gh issue list -S "$search_query" | cut -f1) + existing_issue_id=$(gh issue list -L 1 -S "$search_query" | cut -f1) echo "existing_issue_id: $existing_issue_id" # Create a new issue or comment on the existing one From a4d45f5f466b298c4d53af70391622412566b191 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Sat, 2 Dec 2023 11:46:56 +0100 Subject: [PATCH 36/38] Determine i18n_filename based on input file --- .github/workflows/i18n-consistency-checker.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 6b6f39438..d85d5cb55 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -29,9 +29,14 @@ jobs: # Loop through all files in the English directory for file in $(find patterns/{2-structured,3-validated} -name '*.md'); do echo "Original file: $file" - [[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 - [[ $file =~ "/templates" ]] && continue # if the file is under /templates, skip. consistency check does not work for that yet. - i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)(/project-setup)?_translation/${{matrix.language}}/patterns_g") + #[[ $file =~ "3-validated" ]] && continue # if the file is under 3-validated, skip (one liner) - 2023/08/26 + #[[ $file =~ "/templates" ]] && continue # if the file is under /templates, skip. consistency check does not work for that yet. + + if [[ $file =~ "/templates" ]]; then + i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)/templates_translation/${{matrix.language}}/templates") + else + i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)_translation/${{matrix.language}}/patterns_g") + fi echo "Translation file: $i18n_filename" if [[ ! -e "$i18n_filename" ]]; then From 4d24fff5582ad1142fcd581fa9757ee8a213913c Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Sat, 2 Dec 2023 11:49:50 +0100 Subject: [PATCH 37/38] Fix sed syntax --- .github/workflows/i18n-consistency-checker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index d85d5cb55..4c309c740 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -33,7 +33,7 @@ jobs: #[[ $file =~ "/templates" ]] && continue # if the file is under /templates, skip. consistency check does not work for that yet. if [[ $file =~ "/templates" ]]; then - i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)/templates_translation/${{matrix.language}}/templates") + i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)/templates_translation/${{matrix.language}}/templates_g") else i18n_filename=$(echo "$file" | sed -E "s_patterns/(2-structured|3-validated)_translation/${{matrix.language}}/patterns_g") fi From 586b6837caa9054647c088d23cb3100947a6c6e9 Mon Sep 17 00:00:00 2001 From: Sebastian Spier Date: Sat, 2 Dec 2023 16:12:32 +0100 Subject: [PATCH 38/38] Also write output for files that are entirely untranslated. Write debug output to console. --- .github/workflows/i18n-consistency-checker.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/i18n-consistency-checker.yaml b/.github/workflows/i18n-consistency-checker.yaml index 4c309c740..869701ddf 100644 --- a/.github/workflows/i18n-consistency-checker.yaml +++ b/.github/workflows/i18n-consistency-checker.yaml @@ -41,6 +41,12 @@ jobs: if [[ ! -e "$i18n_filename" ]]; then echo "NOT TRANSLATED" + cat <<- EOM >> issue.md +
New File ($file) + + For more information, please compare [the original file(en)](https://github.com/$GITHUB_REPOSITORY/blob/master/$file). +
+ EOM continue fi @@ -106,6 +112,8 @@ jobs: echo "search_query: $search_query" existing_issue_id=$(gh issue list -L 1 -S "$search_query" | cut -f1) echo "existing_issue_id: $existing_issue_id" + + cat issue-full.md # Create a new issue or comment on the existing one #if expr "$existing_issue_id" : '^[0-9]*$' >/dev/null; then