-
-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (62 loc) · 2.06 KB
/
generate-locale-doc.yml
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
name: Generate Translation Readme
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "i18n/index.ts"
- "scripts/generate-translation-doc.ts"
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs:
generate-locale-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: "22.x"
cache: npm
# Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches.
- name: Fix unsafe repo error
run: git config --global --add safe.directory ${{ github.workspace }}
- name: Run npm install and generate readme
run: |
npm ci
npm run locale-readme-gen
env:
CI: true
- name: Set up Git
run: |
git config user.name "gh-readme-profile"
git config user.email "[email protected]"
git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Push commit to a new branch and create prs
run: |
branch="auto_update_locale_readme"
message="docs(i18n): auto update translation readme"
body="_This pull request was created automatically._"
if [[ "$(git status --porcelain)" != "" ]]; then
git branch -D ${branch} || true
git checkout -b ${branch}
git add i18n/README.md
git commit --message "${message}"
git remote add origin-${branch} "https://github.com/FajarKim/github-readme-profile.git"
git push --force --quiet --set-upstream origin-${branch} ${branch}
gh pr create --title "${message}" --body "${body}"
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}