Skip to content

CLDR-19760 BRS v49: add some commit checker exclusions (#6247) #610

CLDR-19760 BRS v49: add some commit checker exclusions (#6247)

CLDR-19760 BRS v49: add some commit checker exclusions (#6247) #610

Workflow file for this run

name: CLDR Modify
# automatically run CLDRModify
env:
CLDR_DIR: ${{ github.workspace }}
AUTO_BRANCH_BASE: auto/cldrmodify
AUTO_REMOTE: origin
JDK_VERSION: 21
JVM_OPTS: -Dfile.encoding=utf-8 -Dexec.cleanupDaemonThreads=false -DCLDR_GITHUB_ANNOTATIONS=true
on:
push:
# only run this on certain branch(s)
# this can handle other branches, the auto branch will be auto/cldrmodify/some/branch etc
branches:
- 'main'
jobs:
modify:
name: Run CLDRModify
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Clone CLDR
uses: actions/checkout@v6
with:
lfs: false
fetch-depth: 0 # Needed for cldr-archive
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: ${{ env.JDK_VERSION }}
distribution: 'temurin'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache local Maven repository
uses: actions/cache@v5
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 passes
run: |
function cldrmodify() {
echo "- :gear: Running CLDRModify " $1 >> $GITHUB_STEP_SUMMARY
echo "::group::CLDRModify $1"
mvn -s .github/workflows/mvn-settings.xml -B "-DCLDR_DIR=${CLDR_DIR}" --file=tools/pom.xml -pl cldr-code ${JVM_OPTS} exec:java -Dexec.mainClass=org.unicode.cldr.tool.CLDRModify "-Dexec.args=-I -s$1"
echo "::endgroup::"
}
## CLDRModify passes here.
## Add more if need be.
## Note default args set above (-I -s...)
cldrmodify "common/main"
cldrmodify "common/annotations"
cldrmodify "common/subdivisions"
cldrmodify "exemplars/main"
cldrmodify "common/main -fP"
cldrmodify "common/annotations -fP"
cldrmodify "common/subdivisions -fP"
cldrmodify "exemplars/main -fP"
env:
CLDR_DIR: ${{ github.workspace }}
LANG: en_US.UTF-8
- name: Run other tools
run: |
# setup some scripts
# usage: cldr-tool class[.package] arg
function cldr-tool() {
mainClass=$1
shift
arg=$1
if [[ "" == $(echo "${mainClass}" | tr -c -d .) ]];
then
# no package given - use default package
mainClass=org.unicode.cldr.tool.${mainClass}
fi
echo "- :gear: Running ${mainClass}" ${arg} >> $GITHUB_STEP_SUMMARY
echo "::group::${mainClass}" ${arg}
mvn -s .github/workflows/mvn-settings.xml -B "-DCLDR_DIR=${CLDR_DIR}" --file=tools/pom.xml -pl cldr-code ${JVM_OPTS} exec:java -Dexec.mainClass=${mainClass} "-Dexec.args=${arg}"
echo "::endgroup::"
}
## OK, now run the actual tools
mkdir -vp ../cldr-archive
cldr-tool CheckoutArchive
cldr-tool GeneratePluralRanges
cldr-tool GeneratedPluralSamples
cldr-tool GenerateDtd
cldr-tool GenerateValidityXml
cldr-tool ConvertLanguageData
cldr-tool GenerateLikelySubtags
# update common/properties/coverageLevels.txt
# this will also generate charts, but that can be ignored
cldr-tool ShowLocaleCoverage
# update other test data
cldr-tool GenerateTestData
cldr-tool GenerateLocaleIDTestData
cldr-tool GeneratePersonNameTestData
- 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 "${GITHUB_REPOSITORY_OWNER}@users.noreply.github.com"
# add only certain directories.
# This is a failsafe to prevent any other changes.
# Update this if processes change.
git add common/annotations
git add common/main
git add common/properties
git add common/subdivisions
git add common/testData
bash .github/workflows/cldr-modify-commit.sh cldr-modify.yml CLDRModify
git checkout -b ${AUTO_BRANCH_BASE}/${GITHUB_REF_NAME}
# reset origin using token
git remote set-url ${AUTO_REMOTE} "https://${GITHUB_REPOSITORY_OWNER}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
# push ONLY if files under common/ are out of date.
bash .github/workflows/cldr-modify-push-if-needed.sh ${AUTO_REMOTE} ${AUTO_BRANCH_BASE}/${GITHUB_REF_NAME} common/
echo "Note: If any stray files show up here, update cldr-modify.yml"
git status
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: ${GITHUB_REF_NAME} ${GITHUB_WORKFLOW}" \
--body $(git log --pretty=%s HEAD | head -1 | cut -d' ' -f1)" Automatically created, see <https://cldr.unicode.org/development/auto-pr>" \
--base ${GITHUB_REF_NAME} \
--label 'automatic' \
--head ${AUTO_BRANCH_BASE}/${GITHUB_REF_NAME} \
| tee -a $GITHUB_STEP_SUMMARY ) || ( echo "# Could not create PR - may already exist" | tee -a $GITHUB_STEP_SUMMARY )
env:
GH_TOKEN: ${{ github.token }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true