Skip to content

Commit

Permalink
Resolve merge conflict while merging main into dev-fr
Browse files Browse the repository at this point in the history
Signed-off-by: Jihoon Seo <jihoon.seo@etri.re.kr>
  • Loading branch information
jihoon-seo committed Jul 20, 2023
2 parents 7ff9be4 + 8865db9 commit 1ef486e
Show file tree
Hide file tree
Showing 252 changed files with 36,700 additions and 1,350 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new-term.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ body:
required: true
- label: I understand that maintainers will assess if the term should be part of the Glossary. (Please be patient)
required: true
- label: I want to work on this term. (If not checked, maintainers will assign another volunteer)
- label: I want to work on this term and confirm that I meet the criteria as outlined in "[who can contribute](https://glossary.cncf.io/contribute/#who-can-contribute)". (If not checked, maintainers will assign another volunteer)
required: false
- type: textarea
id: note
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/update-term.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body:
options:
- label: I understand that maintainers will confirm if the term should be updated. (Please be patient)
required: true
- label: I want to work on this suggestion. (If not checked, maintainers will assign another volunteer)
- label: I want to work on this suggestion and confirm that I meet the criteria as outlined in "[who can contribute](https://glossary.cncf.io/contribute/#who-can-contribute)".. (If not checked, maintainers will assign another volunteer)
required: false
- type: textarea
id: note
Expand Down
10 changes: 8 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ lang/es:
lang/fr:
- content/fr/*

lang/hi:
- content/hi/*

lang/it:
- content/it/*

lang/hi:
- content/hi/*
lang/ja:
- content/ja/*

lang/ko:
- content/ko/*

lang/pt:
- content/pt-br/*

lang/tw:
- content/zh-tw/*

lang/zh:
- content/zh-cn/*

Expand Down
4 changes: 4 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ collaborators:
- username: nate-double-u
permission: admin

- username: castrojo
permission: push

# Localization approvers

# l10n ko approvers
Expand Down Expand Up @@ -226,6 +229,7 @@ branches:
- iamNoah1
- jihoon-seo
- nate-double-u
- castrojo
teams: []
enforce_admins: null
required_linear_history: null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# This workflow will check if localized terms are outdated or not
# by comparing English terms in the old branch and the latest branch.
name: Check outdated terms
# This workflow will check if a localized content is outdated or not
# by comparing English content in the old branch and the latest branch.
name: Check outdated content
on:
pull_request:
paths:
- 'content/en/**.md'
branches:
- 'dev-ko' # add other branches or use wildcard 'dev-**'
paths:
- 'content/en/**.md'

jobs:
check-outdated-terms:
name: Check outdated terms
check-outdated-content:
name: Check outdated content

# if: contains(fromJSON('["dev-ko", "dev-xx"]'), github.base_ref)
# Ref: https://docs.github.com/en/actions/learn-github-actions/expressions

if: github.base_ref == 'dev-ko'

# Condition to run this workflow on the upstream repository
#if: github.repository == 'cncf/glossary'
Expand All @@ -30,26 +35,30 @@ jobs:
L10N_BRANCH="${{github.base_ref}}"
echo "(DEBUG) L10N Branch: ${L10N_BRANCH}"
# Set output direcory
OUTPUT_DIR="./outdated"
# Set L10n directory and code
case "${L10N_BRANCH}" in
dev-ko)
L10N_DIR="./content/ko/"
L10N_DIR="content/ko/"
L10N_CODE="ko"
;;
#dev-pt)
#L10N_DIR="./content/pt-br/"
#L10N_DIR="content/pt-br/"
#L10N_CODE="pt"
#;;
esac
echo "(DEBUG) L10N Directory: ${L10N_DIR}"
echo "(DEBUG) L10N Code: ${L10N_CODE}"
# Set L10N_DIR and L10N_CODE as environment variables
# Set L10N_DIR, L10N_CODE, and OUTPUT_DIR as environment variables
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "L10N_DIR=${L10N_DIR}" >> $GITHUB_ENV
echo "L10N_CODE=${L10N_CODE}" >> $GITHUB_ENV
echo "L10N_CODE=${L10N_CODE}" >> $GITHUB_ENV
echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -86,40 +95,70 @@ jobs:
# The old branch can be 'upstream/dev-ko'
OLD_BRANCH="origin/${{github.base_ref}}"
echo "(DUBUG) OLD_BRANCH: ${OLD_BRANCH}"
L10N_INFO_JSON=$(cat <<EOF
{
"L10N_DIR": "${L10N_DIR}",
"L10N_CODE": "${L10N_CODE}"
}
EOF
)
# Make an output directory
mkdir outdated
if [[ ! -e $OUTPUT_DIR ]]; then
mkdir $OUTPUT_DIR
echo "${L10N_INFO_JSON}" > ${OUTPUT_DIR}/L10N_INFO.json
elif [[ ! -d $OUTPUT_DIR ]]; then
echo "$OUTPUT_DIR already exists but is not a directory" 1>&2
fi
# Check outdated only if there is a localized term
# Loop files in a localization directory, which is ${L10N_DIR} (e.g., ./content/ko/)
# Check outdated only if a localized content exists
# Loop files in a localization directory, which is ${L10N_DIR} (e.g., content/ko/)
echo "(DEBUG) Check outdated"
for FILE_PATH in $(find ${L10N_DIR} -name '*.md'); do
# ${MYVAR#pattern}: delete shortest match of pattern from the beginning
FILE_NAME="${FILE_PATH#${L10N_DIR}}"
for L10N_FILE_PATH in $(find ${L10N_DIR} -name '*.md'); do
echo "(DEBUG) L10N_FILE_PATH: ${L10N_FILE_PATH}"
# Note - extracting a pattern-based substring (https://stackoverflow.com/a/19482947)
FILE_PATH="${L10N_FILE_PATH#${L10N_DIR}}"
FILE_DIR=$(dirname ${FILE_PATH})
FILE_NAME=$(basename ${FILE_PATH})
echo "(DEBUG) FILE_PATH: ${FILE_PATH}"
echo "(DEBUG) FILE_DIR: ${FILE_DIR}"
echo "(DEBUG) FILE_NAME: ${FILE_NAME}"
echo "(DEBUG) Localized file path: $FILE_PATH"
echo "(DEBUG) Original file path: ./content/en/${FILE_NAME}"
echo "(DEBUG) Localized file path: $L10N_FILE_PATH"
echo "(DEBUG) Original file path: ./content/en/${FILE_PATH}"
# Create subdirectories
mkdir -p ${OUTPUT_DIR}/${FILE_DIR}
# Actually compare between the old and lastest English terms and log diff in the file
if [[ -f "./content/en/${FILE_NAME}" ]]; then
# Actually compare between the old and lastest English content and log diff in the file
if [[ -f "./content/en/${FILE_PATH}" ]]; then
# File exists
git diff ${OLD_BRANCH}..${LATEST_BRANCH} -- ./content/en/${FILE_NAME} > ./outdated/${FILE_NAME}
# Check changes
git diff ${OLD_BRANCH}..${LATEST_BRANCH} -- ./content/en/${FILE_PATH} > temp.diff
if [[ -s "temp.diff" ]]; then
echo "(DEBUG) ${FILE_PATH} is outdated."
mv temp.diff ${OUTPUT_DIR}/${FILE_PATH}
fi
else
echo "(DEBUG) ${FILE_PATH} dose not exist."
# File dose not exist (e.g, changed, renamed or removed)
echo "Could not find ${FILE_NAME} in content/en/" > ./outdated/${FILE_NAME}
echo "Need to check if it has been changed, renamed or removed" >> ./outdated/${FILE_NAME}
echo "Could not find ${FILE_PATH} in content/en/" > ${OUTPUT_DIR}/${FILE_PATH}
echo "Need to check if it has been changed, renamed or removed" >> ${OUTPUT_DIR}/${FILE_PATH}
fi
done
echo "(DEBUG) The outdated files"
ls -al ./outdated
ls -al ${OUTPUT_DIR}
- name: Upload output
uses: actions/upload-artifact@v3
with:
name: ${{ env.L10N_CODE }}-outdated-checking-result
path: ./outdated/
path: ${{ env.OUTPUT_DIR }}/

# - name: Create an issue from file
# uses: peter-evans/create-issue-from-file@v4
Expand All @@ -128,4 +167,4 @@ jobs:
# content-filepath: ${{ steps.checker.outputs.output_path }}
# labels: |
# outdated
# lang/ko
# lang/ko
2 changes: 1 addition & 1 deletion .github/workflows/es-spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ jobs:
set -o errexit
diff content/es/.wordlist.txt <(LC_ALL= sort -f content/es/.wordlist.txt)
- name: GitHub Spellcheck Action
uses: rojopolis/spellcheck-github-actions@0.29.0
uses: rojopolis/spellcheck-github-actions@0.33.1
with:
config_path: content/es/.spellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# This workflow will post outdated terms report
# This workflow will post a report of outdated content
# by using data from previous workflows.
name: Post outdated terms report
name: Post outdated content report

on:
workflow_run:
workflows: ["Check outdated terms"]
workflows: ["Check outdated content"]
types:
- completed

jobs:
post-outdated-report:
name: Post outdated terms report
name: Post outdated content report

if: ${{ github.event.workflow_run.conclusion == 'success' }}

Expand Down Expand Up @@ -53,37 +53,42 @@ jobs:
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: check-outdated-terms.yaml
workflow: check-outdated-content.yaml
workflow_conclusion: success

- name: Set up environment variables from the output
shell: bash
run: |
echo "(DEBUG) Install 'jq' to read json"
sudo apt-get install -y jq
echo "(DEBUG) Display files and directories"
tree
# Set the last changed directory as the output directory
OUTPUT_DIR=$(ls -tp | head -1)
# Extract L10N code from the directory name
# ${MYVAR%%-*}: retain the part before the first '-'
L10N_CODE=${OUTPUT_DIR%%-*}
# Read L10N_DIR and L10N_CODE from L10N_INFO.json
L10N_DIR=$(jq -r '.L10N_DIR' < ${OUTPUT_DIR}/L10N_INFO.json)
L10N_CODE=$(jq -r '.L10N_CODE' < ${OUTPUT_DIR}/L10N_INFO.json)
# Count outdated terms
OUTDATED_TERMS_COUNT=$(ls $OUTPUT_DIR | wc -l)
# Count outdated content
OUTDATED_CONTENT_COUNT=$(ls $OUTPUT_DIR | wc -l)
echo "(DEBUG) OUTPUT_DIR: ${OUTPUT_DIR}"
echo "(DEBUG) L10N_DIR: ${L10N_DIR}"
echo "(DEBUG) L10N_CODE: ${L10N_CODE}"
echo "(DEBUG) OUTDATED_TERMS_COUNT: ${OUTDATED_TERMS_COUNT}"
echo "(DEBUG) OUTDATED_CONTENT_COUNT: ${OUTDATED_CONTENT_COUNT}"
# Set OUTPUT_DIR, L10N_CODE, and OUTDATED_TERMS_COUNT as environment variables
# Set OUTPUT_DIR, L10N_DIR, L10N_CODE, and OUTDATED_CONTENT_COUNT as environment variables
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV
echo "L10N_DIR=${L10N_DIR}" >> $GITHUB_ENV
echo "L10N_CODE=${L10N_CODE}" >> $GITHUB_ENV
echo "OUTDATED_TERMS_COUNT=${OUTDATED_TERMS_COUNT}" >> $GITHUB_ENV
echo "OUTDATED_CONTENT_COUNT=${OUTDATED_CONTENT_COUNT}" >> $GITHUB_ENV
- name: Generate a report markdown
if: ${{ env.OUTDATED_TERMS_COUNT > 0 }}
if: ${{ env.OUTDATED_CONTENT_COUNT > 0 }}
shell: bash
run: |
FILE_LIST=$(find ${OUTPUT_DIR} -name '*.md')
Expand All @@ -92,39 +97,57 @@ jobs:
touch report.md
# Generate markdown
echo "NOTICE - The following outdated terms must be resolved before the next L10n branch updates." >> report.md
echo "This is an issue to track and reflect updates of English content. Please, check the files below as they may have been improved." >> report.md
echo "" >> report.md
echo "NOTICE - The following outdated content should be resolved before the next L10n branch updates." >> report.md
echo "" >> report.md
echo "### Outdated files" >> report.md
echo "### Files to check" >> report.md
for FILE in ${FILE_LIST}; do
FILE_NAME="${FILE#${OUTPUT_DIR}}"
echo "- ${FILE_NAME}" >> report.md
echo "- [ ] ${FILE_NAME}" >> report.md
done
echo "" >> report.md
echo "### Details" >> report.md
echo "### Changes in each file" >> report.md
for FILE in ${FILE_LIST}; do
FILE_NAME="${FILE#${OUTPUT_DIR}}"
echo "Outdated file: ${FILE_NAME}" >> report.md
echo "" >> report.md
echo "\`\`\`diff" >> report.md
cat ${FILE} >> report.md
echo "\`\`\`" >> report.md
echo "#### ${FILE_NAME}" >> report.md
echo "- en: https://github.com/${{ github.repository }}/blob/main/content/en/${FILE_NAME}" >> report.md
echo "- ${{ env.L10N_CODE }}: https://github.com/${{ github.repository }}/blob/dev-${{ env.L10N_CODE }}/${{ env.L10N_DIR }}${FILE_NAME}" >> report.md
echo "" >> report.md
# The collapsible section is applied to improve the readability of the report.
# Apply collapsible section in case the number of lines is greater than 20.
LINES=$(wc -l < ${FILE})
if [[ "$LINES" -gt "20" ]]; then
echo "<details>" >> report.md
echo "<summary><b>Diff in detail</b></summary>" >> report.md
echo "" >> report.md
echo "\`\`\`diff" >> report.md
cat ${FILE} >> report.md
echo "\`\`\`" >> report.md
echo "</details>" >> report.md
echo "" >> report.md
else
echo "\`\`\`diff" >> report.md
cat ${FILE} >> report.md
echo "\`\`\`" >> report.md
echo "" >> report.md
fi
done
echo "The end of report" >> report.md
echo "The end of report" >> report.md
- name: Create an issue from the report
uses: peter-evans/create-issue-from-file@v4
with:
title: "[${{ env.L10N_CODE }}] A report to track update"
title: "[${{ env.L10N_CODE }}] A report to track and reflect updates of English content"
content-filepath: report.md
labels: |
outdated
good first issue
lang/${{ env.L10N_CODE }}
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
- uses: actions/checkout@v3

- name: GitHub Spellcheck Action
uses: rojopolis/spellcheck-github-actions@0.29.0
uses: rojopolis/spellcheck-github-actions@0.33.1
Loading

0 comments on commit 1ef486e

Please sign in to comment.