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

Refactor i18n Consistency Checker Workflow for Improved Efficiency #636

Open
wants to merge 1 commit into
base: i18n-check-fix-empty-comment
Choose a base branch
from
Open
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: 28 additions & 39 deletions .github/workflows/i18n-consistency-checker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,48 +80,37 @@ jobs:
fi

done

- name: Check issue.md existence
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "issue.md"
- 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

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

# 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
search_query="is:issue is:open in:title \"$issue_title\""
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
# Check if the issue.md file exists
if [ -e issue.md ]; then
# 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

# 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

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

# 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
search_query="is:issue is:open in:title \"$issue_title\""
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
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}