-
Couldn't load subscription status.
- Fork 202
I18n check: fix empty comment #586
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
base: main
Are you sure you want to change the base?
Changes from 10 commits
1f11b0a
3c3bc3d
d108c7b
da92975
a2ba3f1
2b432ec
743c384
d3c7b15
7e8f7ca
be68946
cc36c63
4685428
61c178f
7f3ddaf
0ea4033
72cf2df
a52f65d
70717f3
ce7c677
3f09f1e
52167a1
8e0cd53
22bff62
9524620
746f346
7a08700
1ed04bf
02365ec
cd539b9
53eae7a
f066ed8
41ed0bb
247da31
2d0d04d
23a7611
54b6c40
f2cb5ae
a4d45f5
4d24fff
586b683
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,23 +20,12 @@ 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 | ||
| declare -A flags=( ["ja"]=":jp: Japanese" ["zh"]=":cn: Chinese") | ||
|
|
||
| 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 +61,41 @@ jobs: | |
| EOM | ||
| 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: | | ||
| # Heredoc for issue header | ||
| cat <<- EOM > issue-full.md | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than introducing a new file, we could also try to prepend the header to the content of issue.md. Logic in pseudo code: Just not sure how to do this in a shell script :) |
||
| # 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 | ||
| 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: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if a GHA is needed to check for file existence.
Maybe this can be done directly with a GHA expression? Could not find the syntax for that though.
Also assumed that the file-existence-action probably was created for a reason (i.e. that it was not possible differently).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation was set up in the past when we needed to do conditional calls on the GitHub Actions side, but as far as the current implementation is concerned, it only does the work when True, so I don't think we need this.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cross post #636 here
I edited this. Please merge this 🙏
I think my change is what you meant here. I did not push directly because I am not a bit confident about it, but I used PR!