-
-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (63 loc) · 2.53 KB
/
Copy pathupdate_unicode_data.yml
File metadata and controls
78 lines (63 loc) · 2.53 KB
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
name: Update Unicode Data
on:
workflow_dispatch: # Can be triggered manually
schedule:
- cron: '0 0 1 */3 *' # Run at midnight on the 1st of every 3rd month
permissions:
contents: write
pull-requests: write
jobs:
update-unicode-data:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup mise
uses: jdx/mise-action@dba19683ed58901619b14f395a24841710cb4925 # v4.1.0
- name: Install dependencies
run: dart pub get
- name: Generate GitHub App token
id: generate-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.UNICODE_UPDATE_APP_ID }}
private-key: ${{ secrets.UNICODE_UPDATE_PRIVATE_KEY }}
- name: Run Unicode Data Updater
run: dart run tools/unicode_data_updater.dart
- name: Run Normalizer Generator
run: dart run tools/normalizer_gen.dart
- name: Check for changes
id: git-check
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Create branch and commit changes
if: steps.git-check.outputs.changes == 'true'
run: |
# Generate branch name
BRANCH_NAME="unicode-data-update-$(date +'%Y-%m-%d')"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
# Configure git
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
# Create a branch
git checkout -b $BRANCH_NAME
# Add and commit changes
git add .
git commit -m "Update Unicode data and normalization files"
# Push branch
git push origin $BRANCH_NAME
- name: Create Pull Request
if: steps.git-check.outputs.changes == 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
run: |
gh pr create \
--title "Update Unicode Data and Normalization Files" \
--body "This PR updates the Unicode data files and regenerates normalization data. Updated data files in data/ directory and regenerated normalization data. This PR was automatically created by GitHub Actions." \
--base master \
--head "$BRANCH_NAME"