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

Test9 #410

Closed
wants to merge 61 commits into from
Closed

Test9 #410

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
9b88baf
feat: added compare script
sergioarmgpl Apr 4, 2024
a6e0596
feat: mod script
sergioarmgpl Apr 4, 2024
ce5a4f1
feat: added script and workflow to test
sergioarmgpl Apr 18, 2024
88f6395
feat: mod in Check outdated content workflow
sergioarmgpl Apr 18, 2024
dfc6753
feat: removed workflow if
sergioarmgpl Apr 18, 2024
233e426
feat: adding change folder for website content
sergioarmgpl Apr 18, 2024
1712be6
feat: updated print pending translations step
sergioarmgpl Apr 18, 2024
e5d7cc6
feat: printing files to translate per language
sergioarmgpl Apr 18, 2024
6d0912f
feat: added steps to print files to translate
sergioarmgpl Apr 18, 2024
7d301a0
feat: TEST change
sergioarmgpl Apr 18, 2024
8c78b72
feat: update print files
sergioarmgpl Apr 18, 2024
ed60bd5
feat: updated workflow
sergioarmgpl Apr 18, 2024
abc8783
feat: added paths for files to translate
sergioarmgpl Apr 18, 2024
80821b2
feat: mod workflow for escape characters
sergioarmgpl Apr 18, 2024
e3e3270
feat: testing PR
Dianmz Apr 18, 2024
9bb0198
feat: File changed
Dianmz Apr 18, 2024
0a4b458
adding base
Dianmz Apr 18, 2024
d930b40
feat: Adding assigneeses
Dianmz Apr 18, 2024
4105b29
feat: Adding labels
Dianmz Apr 18, 2024
0cabee6
fix: files file fix
Dianmz Apr 18, 2024
884c5c3
Merge pull request #10 from Dianmz/main
sergioarmgpl Apr 19, 2024
61c5e0e
feat: changed PR config
sergioarmgpl Apr 19, 2024
5a249e9
feat: updated push rules
sergioarmgpl Apr 19, 2024
fca7dd5
feat: added workflow if
sergioarmgpl Apr 19, 2024
1ea8f71
feat: workflow changes
sergioarmgpl Apr 19, 2024
cbf9a1f
feat: added branches conf
sergioarmgpl Apr 19, 2024
6a888eb
feat: update base parameter
sergioarmgpl Apr 19, 2024
c35d4b4
update TAG TL information
leonardpahlke Apr 5, 2024
08ef813
add a link to project to the projects README
leonardpahlke Apr 5, 2024
bd688ae
translation(german): Add `de` subfolder in website content directory
thelooter Apr 4, 2024
dd92179
translation(german): Add German to config.toml
thelooter Apr 4, 2024
c8538d0
translation(german): Correct spelling of Cloud Native in Hugo Config
thelooter Apr 5, 2024
c7765b8
translation(german): Translate about/ folder to german
thelooter Apr 7, 2024
406911e
docs: add Green Scraper project
guidemetothemoon Apr 7, 2024
5965447
chore: add project GH links on website
guidemetothemoon Apr 7, 2024
53e8006
add claire to wg comms chair list
leonardpahlke Apr 9, 2024
4aee161
Add German translation for TAG Environmental Sustainability _index.md…
rissh Apr 10, 2024
6ac048e
chore: update Green Scraper project info
guidemetothemoon Apr 16, 2024
b270ede
feat: update last step
sergioarmgpl Apr 19, 2024
9bfb70e
feat: test
sergioarmgpl Apr 19, 2024
57a1f04
feat: added issue generation part
sergioarmgpl Apr 19, 2024
cea1344
feat: updated workflow
sergioarmgpl Apr 19, 2024
a7aaefc
feat: update Issue step
sergioarmgpl Apr 19, 2024
ebc41e8
feat: updated file extension
sergioarmgpl Apr 19, 2024
099ef96
feat: updated labels format
sergioarmgpl Apr 24, 2024
27c6e3c
feat: updated labels
sergioarmgpl Apr 24, 2024
ecb59a6
feat: changed labels format
sergioarmgpl Apr 24, 2024
58af090
feat: removed extra labels
sergioarmgpl Apr 24, 2024
18cf043
Merging last changes from the workflow to translate into different la…
Dianmz May 1, 2024
9a18dce
feat: removed changes on files to test workflow, and merging Dianmz c…
sergioarmgpl May 1, 2024
604a36d
feat: sync changes
sergioarmgpl May 1, 2024
b4ae477
Merge branch 'cncf:main' into main
sergioarmgpl May 1, 2024
0d89518
feat: added specific groups for translate issues
sergioarmgpl May 1, 2024
1f9f198
feat: updated assignees
sergioarmgpl May 1, 2024
7500f1b
feat: removed ASSIGNEES parameter
sergioarmgpl May 1, 2024
016e24f
feat: testing assignees
sergioarmgpl May 1, 2024
7667ff2
feat: testing assignees
sergioarmgpl May 1, 2024
20afc36
feat: hard coded assignee
sergioarmgpl May 1, 2024
8569fcf
feat: removed unnecessary variables
sergioarmgpl May 1, 2024
26b422a
feat: changed lang validation
sergioarmgpl May 1, 2024
a809ea5
feat: updated test9
sergioarmgpl May 1, 2024
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
159 changes: 159 additions & 0 deletions .github/workflows/check-outdated-content.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# Contribution by Cloud Native Guatemala folks :)
# 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:


jobs:
check-outdated-content:
name: Check outdated content
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all history for all tags and branches
- name: Detecting pending translations
shell: bash
run: |
##### DEBUG section, this will be removed later ###########
ls -al
git status
git branch

# Default environment variables
echo "GITHUB_REF: $GITHUB_REF"
echo "Extract branch: ${GITHUB_REF#refs/}"

# `github` context information
echo "(DEBUG) github.ref: ${{github.ref}}"
echo "(DEBUG) github.head_ref: ${{github.head_ref}}"
echo "(DEBUG) github.base_ref: ${{github.base_ref}}"
#####################################################

OUTPUT_DIR="./outdated"
CONTENT_DIR="website/content"
languages=("es" "zh")
base_lang="en"
cd $CONTENT_DIR

echo "(DEBUG) Current folder: "$(pwd)

for lang in ${languages[@]}; do
touch $lang.txt
done

touch $base_lang.txt

# Make an output directory
if [[ ! -e $OUTPUT_DIR ]]; then
mkdir $OUTPUT_DIR
elif [[ ! -d $OUTPUT_DIR ]]; then
echo "$OUTPUT_DIR already exists but is not a directory" 1>&2
fi

LATEST_BRANCH=${GITHUB_REF#refs/}
echo "(DEBUG) LATEST_BRANCH: ${LATEST_BRANCH}"

# Get the old branch from 'github.base_ref'
# The old branch can be 'upstream/dev-ko'
OLD_BRANCH="origin/${{github.base_ref}}"
echo "(DEBUG) OLD_BRANCH: ${OLD_BRANCH}"

compare () {
FILE_PATH=$1
# Actually compare between the old and latest English content and log diff in the file
if [[ -f "${FILE_PATH}" ]]; then
# File exists
# Check changes
git diff ${OLD_BRANCH}..${LATEST_BRANCH} -- ${FILE_PATH} > temp.diff
if [[ -s "temp.diff" ]]; then
echo "(DEBUG) ${FILE_PATH} is outdated."
mkdir -p ${OUTPUT_DIR}/${FILE_PATH%/*}
mv temp.diff ${OUTPUT_DIR}/${FILE_PATH}
else
echo "check if ${FILE_PATH} exist in other languages"
for lang in ${languages[@]}; do
NEW_FILE_PATH=$(echo "${FILE_PATH}" | sed -e "s/${base_lang}\//${lang}\//g")
if [[ ! -e "${NEW_FILE_PATH}" ]]; then
echo "The file ${FILE_PATH} needs to be translated to $lang"
echo ${NEW_FILE_PATH} >> $lang.txt
fi
done
fi
else
echo "(DEBUG) ${FILE_PATH} does not exist."
fi
}

find $base_lang -iname "*.md" > files.txt
sort files.txt > files_temp.txt;mv files_temp.txt files.txt
INFILE=files.txt

while IFS= read -r line
do
compare "$line"
done < "$INFILE"

find outdated -iname "*.md" | sed -e "s/outdated/website\/content/g" > $base_lang.txt

- name: Generate content for translation issues
id: to_translate
shell: bash
run: |
CONTENT_DIR="website/content"
cd $CONTENT_DIR
echo "(DEBUG) Current folder: "$(pwd)
languages=("es" "zh")
for lang in ${languages[@]}; do
FILES=""

if [ "$lang" == "es" ]; then
TEAM="Dianmz"
elif [ "$lang" == "zh" ]; then
TEAM="sergioarmgpl"
fi

echo "---" > $lang"_files.md"
echo "title: Pending pages to translate into $lang" >> $lang"_files.md"
echo "assignees: $TEAM" >> $lang"_files.md"
echo 'labels:' >> $lang"_files.md"
echo ' - help wanted' >> $lang"_files.md"
echo ' - translations' >> $lang"_files.md"
echo ' - good first issue' >> $lang"_files.md"
echo ' - issue/tracking' >> $lang"_files.md"
echo "---" >> $lang"_files.md"
echo "Last change by: {{ payload.sender.login }}." >> $lang"_files.md"
echo -e "*Docs to translate for "$lang" language* <br />\n" >> $lang"_files.md"
while IFS= read -r line
do
FILES+="- $line <br />\n"
done < "$lang.txt"
echo -e $FILES >> $lang"_files.md"
done
- name: Print files to translate per language
shell: bash
run: |
CONTENT_DIR="website/content"
echo "(DEBUG) Current folder "$(pwd)
echo "(DEBUG) ES files"
echo -e $(cat $CONTENT_DIR/es_files.md)
echo "(DEBUG) ZH files"
echo -e $(cat $CONTENT_DIR/zh_files.md)
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
update_existing: true
filename: website/content/es_files.md
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
update_existing: true
filename: website/content/zh_files.md

3 changes: 3 additions & 0 deletions website/content/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.txt
*.diff
outdated/
2 changes: 1 addition & 1 deletion website/content/en/_index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: TAG Environmental Sustainability
title: TAG Environmental Sustainability 123
toc_hide: true
---

Expand Down
Loading
Loading