Skip to content

Commit d4cc797

Browse files
committed
Add draft version of the GitHub Action
1 parent 2a12d6f commit d4cc797

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/deep-diff.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# This script lists files that have been added or edited under a specified directory,
3+
# including the targets of any symlinks.
4+
5+
set -e
6+
7+
if [ "$#" -ne 1 ] && [ "$#" -ne 3 ]; then
8+
echo "The number of arguments must be either 1 or 3."
9+
echo "Usage: ./list-targets.sh [path] <[commit] [commit]>"
10+
exit 1
11+
fi
12+
13+
if [ "$#" -eq 1 ]; then
14+
git diff --name-only "$1"
15+
else
16+
git diff --name-only "$2" "$3" "$1"
17+
fi
18+
19+
# Differences in targets of symbolic links.
20+
symlinks=$(find "$1" -type l)
21+
for l in ${symlinks}; do
22+
linktarget=$(readlink -f "${l}")
23+
24+
if [ "$#" -eq 1 ]; then
25+
git diff --name-only "$(realpath --relative-to=. "${linktarget}")"
26+
else
27+
git diff --name-only "$2" "$3" "$(realpath --relative-to=. "${linktarget}")"
28+
fi
29+
done
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Notice i18n Tasks
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
9+
jobs:
10+
notice-i18n-tasks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out
14+
uses: actions/checkout@v4
15+
with:
16+
ref: ${{ github.head_ref }}
17+
fetch-depth: 0
18+
19+
- name : Check the diffs when the issue is opened
20+
id: diff-check-opened
21+
if: github.event.action == 'opened' || github.event.action == 'reopened'
22+
run: |
23+
echo "diff-count=$(.github/workflows/deep-diff.sh hoge | wc -l)" >> $GITHUB_OUTPUT
24+
25+
- name: Check the diffs when the content in the PR updated
26+
id: diff-check-updated
27+
if: github.event.action == 'synchronize'
28+
run: |
29+
echo "diff-count=$(.github/workflows/deep-diff.sh hoge ${{ github.event.before }} ${{ github.event.after }} | wc -l)" >> $GITHUB_OUTPUT
30+
31+
- name: Send notice on the issue
32+
if: steps.diff-check-opened.outputs.diff-count > 0 || steps.diff-check-updated.outputs.diff-count > 0
33+
uses: thollander/actions-comment-pull-request@v2
34+
with:
35+
message: |
36+
### Action Required
37+
You are adding or updating English content so please take the following actions for other languages.
38+
- If you add new content under `website/content/en` or targets of the symbolic links in the same directory, please replicate it in the corresponding directories of all other languages. (e.g. If you create `website/content/en/blog/new-post.md`, you should copy it to `website/content/ja/blog/new-post.md`, etc.)
39+
- If you update the content in the same location, please perform the following actions for the corresponding content in other languages.
40+
- If the content has not been translated yet, replace the files with the updated English version.
41+
- If the content has already been translated, include a note suggesting that users check the English page for the most recent updates.

0 commit comments

Comments
 (0)