File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Replace Version Text-Safe
2+
3+ on :
4+ workflow_dispatch :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ replace-version :
11+ runs-on : ubuntu-latest
12+ permissions :
13+ contents : write
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v3
17+ with :
18+ persist-credentials : false
19+
20+ - name : Setup Git identity
21+ run : |
22+ git config user.name "github-actions[bot]"
23+ git config user.email "github-actions[bot]@users.noreply.github.com"
24+
25+ - name : Ultra-precise text-only replacement
26+ run : |
27+ echo "Replacing all 2.0.2 → 2.2.0 in text/code files only..."
28+ find . -type f ! -path "*/.git/*" ! -path "*/.github/*" -print0 | while IFS= read -r -d '' file; do
29+ if file --mime "$file" | grep -q 'charset='; then
30+ perl -pi -e 's/(^|[^0-9])2\.0\.2([^0-9]|$)/${1}2.2.0${2}/g' "$file"
31+ fi
32+ done
33+
34+ - name : Commit & push changes
35+ run : |
36+ git add .
37+ git diff --cached --quiet || git commit -m "Text-safe update: 2.0.2 → 2.2.0 [skip ci]"
38+ git push "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:${GITHUB_REF#refs/heads/}
You can’t perform that action at this time.
0 commit comments