FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-docs-fa/.github/workflows/sync-with-cpython.yml at 3.14 · python/python-docs-fa · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python
/
python-docs-fa
Public
Notifications
You must be signed in to change notification settings
Fork
11
Star
51
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-docs-fa
/
.github
/
workflows
/
sync-with-cpython.yml
Copy path
View runs
More file actions
More file actions
Latest commit
History
History
History
120 lines (106 loc) · 3.72 KB
Breadcrumbs
python-docs-fa
/
.github
/
workflows
/
sync-with-cpython.yml
Copy path
File metadata and controls
120 lines (106 loc) · 3.72 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name
:
Sync with CPython
on
:
schedule
:
-
cron
:
'
0 4 * * *
'
workflow_dispatch
:
inputs
:
cpython_tag
:
description
:
'
CPython tag to sync against (e.g. v3.14.7)
'
required
:
false
default
:
'
v3.14.7
'
permissions
:
contents
:
write
issues
:
write
concurrency
:
group
:
sync
cancel-in-progress
:
false
jobs
:
sync
:
runs-on
:
ubuntu-latest
env
:
CPYTHON_TAG
:
${{ github.event.inputs.cpython_tag || 'v3.14.7' }}
steps
:
-
name
:
Checkout translation repo
uses
:
actions/checkout@v4
with
:
fetch-depth
:
0
-
name
:
Set up Python
uses
:
actions/setup-python@v4
with
:
python-version
:
'
3.12
'
-
name
:
Install gettext
run
:
sudo apt-get install -y gettext
-
name
:
Install Python dependencies
run
:
pip install sphinx sphinx-intl
#
Item 4: fetch/build/merge/validate now all live in one shared
#
module (scripts/po_sync.py) instead of inline bash/awk here, so
#
this workflow can't drift from update_python_version.py the way
#
it did before (missing --no-location --no-wrap on one side).
-
name
:
Sync msgids (fetch, build gettext, merge, validate)
run
:
python scripts/po_sync.py sync-only "$CPYTHON_TAG"
-
name
:
Ensure translation label exists
env
:
GH_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
run
:
|
gh label create "translation" \
--color "0075ca" \
--description "Translation review needed" \
--repo ${{ github.repository }} \
2>/dev/null ||
true
-
name
:
Open issue for fuzzy strings
env
:
GH_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
run
:
|
tmpfile=$(mktemp)
while IFS= read -r f; do
fuzzy=$(msgattrib --only-fuzzy --no-obsolete "$f" 2>/dev/null)
if [ -n "$fuzzy" ]; then
entries=$(echo "$fuzzy" | awk '
/^msgid / {
first=$0; msg=$0"\n"; lines=1; incapture=1; next
}
incapture && /^"/ {
msg = msg $0 "\n"; lines++; next
}
incapture && /^msgstr/ {
incapture=0
if (!(first == "msgid \"\"" && lines==1)) {
printf "- %s\n", msg
}
next
}
')
count=$(echo "$entries" | grep -c '^- ' || echo 0)
if [ "$count" -gt 0 ]; then
echo "### $f ($count fuzzy)" >> "$tmpfile"
echo "$entries" | head -20 >> "$tmpfile"
echo "" >> "$tmpfile"
fi
fi
done < <(find . -name "*.po" \
-not -path "./.git/*" \
-not -path "./.cpython-src/*" \
-not -path "./.pot-templates/*")
if [ -s "$tmpfile" ]; then
gh issue create \
--title "🔍 Fuzzy strings need review after CPython sync ($(date +%Y-%m-%d))" \
--body "$(cat "$tmpfile")
Triggered by sync with \`$CPYTHON_TAG\`." \
--label "translation" \
--repo ${{ github.repository }}
fi
rm -f "$tmpfile"
-
name
:
Stage changes
run
:
git add --all
-
name
:
Unstage POT-Creation-Date-only changes
run
:
python scripts/unstage_cosmetic.py
-
name
:
Commit if changed
run
:
|
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --staged --quiet; then
echo "Nothing to commit, skipping."
exit 0
fi
git commit -m "chore: sync msgids with CPython $CPYTHON_TAG"
git push
Back
|
FazBrowse Home
|
New Git URL