Skip to content

CLDR-19216 SpecFix from d534eb0 (#5440) #37

CLDR-19216 SpecFix from d534eb0 (#5440)

CLDR-19216 SpecFix from d534eb0 (#5440) #37

Workflow file for this run

name: CLDR Modify
# automatically run CLDRModify
env:
CLDR_DIR: ${{ github.workspace }}
AUTO_BRANCH: auto/cldrmodify/main
AUTO_REMOTE: origin
on:
push:
# only run this on certain branch(s)
branches:
- 'main'
jobs:
modify:
name: Run CLDRModify
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Clone CLDR
uses: actions/checkout@v4
with:
lfs: false
fetch-depth: 1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-cldrmodify-${{ hashFiles('tools/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-cldrmodify-
${{ runner.os }}-maven-
- name: Build cldr-code
# compile only, we don't want to take the time to package
run: >
mvn -s .github/workflows/mvn-settings.xml -B compile --file tools/pom.xml
-DskipTests=true -pl cldr-code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run CLDR-modify common/main
# note: This only runs ONE pass of CLDRModify for now, on one directory (common/main)
# TODO: See CLDR-14120
run: >
export TMPD=$(mktemp -d)
CLDR_DIR=$(pwd) ;
LANG=en_US.UTF-8
mvn -s .github/workflows/mvn-settings.xml -B
"-DCLDR_DIR=${CLDR_DIR}"
--file=tools/pom.xml
-pl cldr-code
-Dfile.encoding=utf-8 exec:java
-Dexec.mainClass=org.unicode.cldr.tool.CLDRModify
-Dexec.args="modify -d${TMPD} -s$(pwd)/common/main" &&
(mv -v ${TMPD}/*.xml common/main/ || true)
- name: Verify git Changes
id: gitstatus
run: |
echo '### Changes' >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
git status | tee -a $GITHUB_STEP_SUMMARY
git diff --stat | tee -a $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
( echo changecount=$(git diff 2>/dev/null | wc -l) ) | tee -a $GITHUB_OUTPUT
- name: Update branch
if: steps.gitstatus.outputs.changecount > 0
run: |
set -euxo pipefail
git config user.name 'cldr-modify.yml [bot]'
git config user.email 'unicode-org@users.noreply.github.com'
git add common/main
bash .github/workflows/cldr-modify-commit.sh cldr-modify.yml CLDRModify
git checkout -b ${AUTO_BRANCH}
# reset origin using token
git remote set-url ${AUTO_REMOTE} "https://unicode-org:${GH_TOKEN}@github.com/unicode-org/cldr.git"
# push ONLY if files under common/ are out of date.
bash .github/workflows/cldr-modify-push-if-needed.sh ${AUTO_REMOTE} ${AUTO_BRANCH} common/
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Open PR
if: steps.gitstatus.outputs.changecount > 0
run: |
set -euxo pipefail
( gh pr create \
--title $(git log --pretty=%s HEAD | head -1 | cut -d' ' -f1)" auto: CLDRModify" \
--body $(git log --pretty=%s HEAD | head -1 | cut -d' ' -f1)" Automatically created, see CLDR-16083" \
--base 'main' \
--reviewer 'unicode-org/cldr-brs' \
--label 'automatic' \
--head ${AUTO_BRANCH} \
| tee -a $GITHUB_STEP_SUMMARY ) || ( echo "# Could not create PR - may already exist" | tee -a $GITHUB_STEP_SUMMARY )
env:
GH_TOKEN: ${{ github.token }}