1
- # This workflow will post outdated terms report
1
+ # This workflow will post a report of outdated content
2
2
# by using data from previous workflows.
3
- name : Post outdated terms report
3
+ name : Post outdated content report
4
4
5
5
on :
6
6
workflow_run :
7
- workflows : ["Check outdated terms "]
7
+ workflows : ["Check outdated content "]
8
8
types :
9
9
- completed
10
10
11
11
jobs :
12
12
post-outdated-report :
13
- name : Post outdated terms report
13
+ name : Post outdated content report
14
14
15
15
if : ${{ github.event.workflow_run.conclusion == 'success' }}
16
16
@@ -53,37 +53,42 @@ jobs:
53
53
uses : dawidd6/action-download-artifact@v2
54
54
with :
55
55
github_token : ${{secrets.GITHUB_TOKEN}}
56
- workflow : check-outdated-terms .yaml
56
+ workflow : check-outdated-content .yaml
57
57
workflow_conclusion : success
58
58
59
59
- name : Set up environment variables from the output
60
60
shell : bash
61
61
run : |
62
+ echo "(DEBUG) Install 'jq' to read json"
63
+ sudo apt-get install -y jq
64
+
62
65
echo "(DEBUG) Display files and directories"
63
66
tree
64
67
65
68
# Set the last changed directory as the output directory
66
69
OUTPUT_DIR=$(ls -tp | head -1)
67
70
68
- # Extract L10N code from the directory name
69
- # ${MYVAR%%-*}: retain the part before the first '-'
70
- L10N_CODE=${OUTPUT_DIR%%-*}
71
+ # Read L10N_DIR and L10N_CODE from L10N_INFO.json
72
+ L10N_DIR=$(jq -r '.L10N_DIR' < ${OUTPUT_DIR}/L10N_INFO.json)
73
+ L10N_CODE=$(jq -r '.L10N_CODE' < $ {OUTPUT_DIR}/L10N_INFO.json)
71
74
72
- # Count outdated terms
73
- OUTDATED_TERMS_COUNT =$(ls $OUTPUT_DIR | wc -l)
75
+ # Count outdated content
76
+ OUTDATED_CONTENT_COUNT =$(ls $OUTPUT_DIR | wc -l)
74
77
75
78
echo "(DEBUG) OUTPUT_DIR: ${OUTPUT_DIR}"
79
+ echo "(DEBUG) L10N_DIR: ${L10N_DIR}"
76
80
echo "(DEBUG) L10N_CODE: ${L10N_CODE}"
77
- echo "(DEBUG) OUTDATED_TERMS_COUNT : ${OUTDATED_TERMS_COUNT }"
81
+ echo "(DEBUG) OUTDATED_CONTENT_COUNT : ${OUTDATED_CONTENT_COUNT }"
78
82
79
- # Set OUTPUT_DIR, L10N_CODE, and OUTDATED_TERMS_COUNT as environment variables
83
+ # Set OUTPUT_DIR, L10N_DIR, L10N_CODE, and OUTDATED_CONTENT_COUNT as environment variables
80
84
# Ref: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
81
85
echo "OUTPUT_DIR=${OUTPUT_DIR}" >> $GITHUB_ENV
86
+ echo "L10N_DIR=${L10N_DIR}" >> $GITHUB_ENV
82
87
echo "L10N_CODE=${L10N_CODE}" >> $GITHUB_ENV
83
- echo "OUTDATED_TERMS_COUNT =${OUTDATED_TERMS_COUNT }" >> $GITHUB_ENV
88
+ echo "OUTDATED_CONTENT_COUNT =${OUTDATED_CONTENT_COUNT }" >> $GITHUB_ENV
84
89
85
90
- name : Generate a report markdown
86
- if : ${{ env.OUTDATED_TERMS_COUNT > 0 }}
91
+ if : ${{ env.OUTDATED_CONTENT_COUNT > 0 }}
87
92
shell : bash
88
93
run : |
89
94
FILE_LIST=$(find ${OUTPUT_DIR} -name '*.md')
@@ -92,39 +97,57 @@ jobs:
92
97
touch report.md
93
98
94
99
# Generate markdown
95
- echo "NOTICE - The following outdated terms must be resolved before the next L10n branch updates." >> report.md
100
+ 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
101
+ echo "" >> report.md
102
+ echo "NOTICE - The following outdated content should be resolved before the next L10n branch updates." >> report.md
96
103
echo "" >> report.md
97
- echo "### Outdated files " >> report.md
104
+ echo "### Files to check " >> report.md
98
105
99
106
for FILE in ${FILE_LIST}; do
100
107
FILE_NAME="${FILE#${OUTPUT_DIR}}"
101
- echo "- ${FILE_NAME}" >> report.md
108
+ echo "- [ ] ${FILE_NAME}" >> report.md
102
109
done
103
110
104
111
echo "" >> report.md
105
112
106
- echo "### Details " >> report.md
113
+ echo "### Changes in each file " >> report.md
107
114
108
115
for FILE in ${FILE_LIST}; do
109
116
FILE_NAME="${FILE#${OUTPUT_DIR}}"
110
117
111
- echo "Outdated file: ${FILE_NAME}" >> report.md
112
- echo "" >> report.md
113
- echo "\`\`\`diff" >> report.md
114
- cat ${FILE} >> report.md
115
- echo "\`\`\`" >> report.md
118
+ echo "#### ${FILE_NAME}" >> report.md
119
+ echo "- en: https://github.com/${{ github.repository }}/blob/main/content/en/${FILE_NAME}" >> report.md
120
+ echo "- ${{ env.L10N_CODE }}: https://github.com/${{ github.repository }}/blob/dev-${{ env.L10N_CODE }}/${{ env.L10N_DIR }}${FILE_NAME}" >> report.md
116
121
echo "" >> report.md
117
-
122
+
123
+ # The collapsible section is applied to improve the readability of the report.
124
+ # Apply collapsible section in case the number of lines is greater than 20.
125
+ LINES=$(wc -l < ${FILE})
126
+ if [[ "$LINES" -gt "20" ]]; then
127
+ echo "<details>" >> report.md
128
+ echo "<summary><b>Diff in detail</b></summary>" >> report.md
129
+ echo "" >> report.md
130
+ echo "\`\`\`diff" >> report.md
131
+ cat ${FILE} >> report.md
132
+ echo "\`\`\`" >> report.md
133
+ echo "</details>" >> report.md
134
+ echo "" >> report.md
135
+ else
136
+ echo "\`\`\`diff" >> report.md
137
+ cat ${FILE} >> report.md
138
+ echo "\`\`\`" >> report.md
139
+ echo "" >> report.md
140
+ fi
141
+
118
142
done
119
143
120
- echo "The end of report" >> report.md
144
+ echo "The end of report" >> report.md
121
145
122
146
- name : Create an issue from the report
123
147
uses : peter-evans/create-issue-from-file@v4
124
148
with :
125
- title : " [${{ env.L10N_CODE }}] A report to track update "
149
+ title : " [${{ env.L10N_CODE }}] A report to track and reflect updates of English content "
126
150
content-filepath : report.md
127
151
labels : |
128
152
outdated
129
- good first issue
130
153
lang/${{ env.L10N_CODE }}
0 commit comments