Skip to content

CLDR-19757 Explicitly specify forbidden pattern fields in skeletons #227

CLDR-19757 Explicitly specify forbidden pattern fields in skeletons

CLDR-19757 Explicitly specify forbidden pattern fields in skeletons #227

Workflow file for this run

name: LDML Spec
env:
CLDR_DIR: ${{ github.workspace }}
AUTO_BRANCH: auto/tr35/main
AUTO_REMOTE: origin
permissions:
pages: write
deployments: write
id-token: write
actions: read
on:
pull_request:
paths:
- "tools/scripts/tr-archive/**"
- "docs/ldml/**"
- ".github/workflows/spec.yml"
push:
branches:
- main
- "maint/maint-*"
tags:
- "release-*"
# Only run if docs change.
paths:
- "tools/scripts/tr-archive/**"
- "docs/ldml/**"
- ".github/workflows/spec.yml"
jobs:
build:
name: "Build Spec"
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
lfs: false
fetch-depth: 1
- name: Cache local npm repository
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-nodetr-${{ hashFiles('tools/scripts/tr-archive/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodetr-
nodetr-
- uses: nodenv/actions/node-version@v4 # setup using .node-version
- name: Run TR archiver
# Note: will update ToC if out of date
run: "cd tools/scripts/tr-archive/ && npm ci && npm run build"
- name: Upload tr35.zip
uses: actions/upload-artifact@v7
with:
name: tr35-spec
path: tools/scripts/tr-archive/tr35.zip
- name: Validate tr35-versions.yml
run: python3 tools/scripts/tr-archive/tr35-links.py docs/ldml/tr35-versions.yml check
- name: Upload tr35-versions.yml
uses: actions/upload-artifact@v7
with:
name: tr35-versions
path: docs/ldml/tr35-versions.yml
- name: "Check internal anchors in spec"
# Note: see CLDR-16526 for making this an error
# see <tools/scripts/tr-archive/README.md> for instructions
run: "cd tools/scripts/tr-archive/ && npm run extract-link-targets"
- name: Lint Markdown
# Warn, don't fail yet
run: npx markdownlint-cli docs/ldml/*.md || (echo Warning, please fix these ; true)
- name: Note any changes
# if the archiver had to update anything, or if anchors changed
run: git status ; git diff
- name: Restore lychee cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lycheespec-${{ github.sha }}
restore-keys: cache-lycheespec-
- name: Run lychee
uses: lycheeverse/lychee-action@v2.8.0
with:
args: "-n --cache --max-cache-age 10d docs/ldml"
fail: false
format: markdown
output: linkcheck.md
- name: Link Checker Summary
run: cat linkcheck.md >> $GITHUB_STEP_SUMMARY
- name: Verify SpecFix Changes
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: gitstatus
run: |
echo '### tr35 fixups' >> $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 SpecFix branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.gitstatus.outputs.changecount > 0
run: |
set -euxo pipefail
git config user.name 'spec.yml [bot]'
git config user.email 'unicode-org@users.noreply.github.com'
git add docs/ldml
bash .github/workflows/cldr-modify-commit.sh spec.yml SpecFix
bash tools/scripts/tr-archive/check-mod-section.sh HEAD "origin/main" || (echo '<!--' 'Auto SpecFix' $(date) '-->' | tee -a docs/ldml/tr35-modifications.md && git commit --amend -C HEAD docs/ldml/tr35-modifications.md)
git log -n 1
git checkout -b ${AUTO_BRANCH}
# reset origin using token
git remote set-url ${AUTO_REMOTE} "https://unicode-org:${GH_TOKEN}@github.com/${GITHUB_REPO}.git"
# push ONLY if files under common/ are out of date.
bash .github/workflows/cldr-modify-push-if-needed.sh ${AUTO_REMOTE} ${AUTO_BRANCH} docs/ldml/
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
- name: Open SpecFix PR
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.gitstatus.outputs.changecount > 0
run: |
set -euxo pipefail
( gh pr create \
--title $(git log --pretty=%s HEAD | head -1 | cut -d' ' -f1)" auto: SpecFix" \
--body $(git log --pretty=%s HEAD | head -1 | cut -d' ' -f1)" Automatically created, see <https://cldr.unicode.org/development/auto-pr>" \
--base 'main' \
--label 'automatic' \
--head ${AUTO_BRANCH} \
| tee -a $GITHUB_STEP_SUMMARY ) || ( echo "# Could not create PR - may already exist" | tee -a $GITHUB_STEP_SUMMARY )
# --reviewer 'unicode-org/cldr-brs' \
env:
GH_TOKEN: ${{ github.token }}
preview:
name: "Deploy Spec to preview"
environment:
name: spec-preview
permissions:
pull-requests: write
runs-on: ubuntu-latest
needs: build
steps:
#note: no checkout needed.
- name: Download TR35.zip
uses: actions/download-artifact@v8
with:
name: tr35-spec
- name: Unpack
run: unzip tr35.zip
- name: Extract Metadata
id: metadata
run: |
# dump all metadata
jq . < dist/js/metadata.json
(echo -n 'revision=' ; jq -r .info.revision < dist/js/metadata.json) | tee -a $GITHUB_OUTPUT
- name: Fixup more stuff
run: |
cp -nv dist/tr35.html dist/index.html
cd dist
curl -O 'https://www.unicode.org/reports/reports-v2.css'
curl -O 'https://www.unicode.org/reports/logo60s2.gif'
- run: npm i -g wrangler@latest
- name: Push spec to preview
uses: cloudflare/wrangler-action@v3
id: deploy
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'unicode-org/cldr'
with:
apiToken: ${{ secrets.CF_KEY }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: |
versions upload --name ${{ vars.CF_PROJECT }} ${{ github.event_name == 'pull_request' && format('--preview-alias pr{0}', github.event.pull_request.number) || '' }} --no-bundle --assets ./dist --compatibility-date 2026-03-19
- name: Add deploy comment to Summary
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'unicode-org/cldr'
run: echo "### Spec update tr35-${{ steps.metadata.outputs.revision }} preview at <${{ steps.deploy.outputs.deployment-url }}>" >> $GITHUB_STEP_SUMMARY
- name: Add deploy comment to PR
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'unicode-org/cldr'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✨ Spec update preview at <${{ steps.deploy.outputs.deployment-url }}> \n✨ '
})
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['Spec Update']
})
production:
if: github.repository == 'unicode-org/cldr' && github.event_name == 'push' && (contains(github.ref, 'maint/maint-') || (github.ref == 'refs/heads/main'))
name: "Deploy Spec to production"
environment:
name: spec-production
runs-on: ubuntu-latest
needs: build
steps:
#note: no checkout needed.
- name: Download TR35.zip
uses: actions/download-artifact@v8
with:
name: tr35-spec
- name: Unpack
run: unzip tr35.zip
- name: Extract Metadata
id: metadata
run: |
# dump all metadata
jq . < dist/js/metadata.json
(echo -n 'revision=' ; jq -r .info.revision < dist/js/metadata.json) | tee -a $GITHUB_OUTPUT
- name: Download tr35-versions.yml
if: github.ref == 'refs/heads/main'
uses: actions/download-artifact@v8
with:
name: tr35-versions
- name: Setup ssh
# For the host key verification of ssh behind rsync.
run: |
mkdir ~/.ssh
echo "sarasvati.unicode.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGx+XeCMGtRbA7X26EVcYG41zQrZmM05Vw5I0zISPqz9f+94Vlm4P26hsmY/DCA1j4EMlbbiISqRqzbLfAz1s5s=" >> ~/.ssh/known_hosts
echo "cldr-smoke.unicode.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKebRPtFh4wfiya5UX+8OGJorbdu66PeXASGLvgmSMgewsBF0LwS2r5qcMlv11LdSQh/PrP0gWndmG7bBOQOZj0=" >> ~/.ssh/known_hosts
echo "${SSH_KEY}" | base64 -d > ~/.ssh/id_rsa
md5sum ~/.ssh/id_rsa
echo "Host ${{ vars.SSH_HOST }}" >> ~/.ssh/config
echo " User ${{ vars.SSH_USER }}" >> ~/.ssh/config
echo " Port ${{ vars.SSH_PORT }}" >> ~/.ssh/config
echo " IdentityFile ${HOME}/.ssh/id_rsa" >> ~/.ssh/config
cat ~/.ssh/config
chmod -R go= ~/.ssh
env:
SSH_KEY: ${{ secrets.SSH_KEY }}
- name: Sync spec to server
run: |
rsync --recursive --delete --delete-after --verbose --verbose \
dist/ \
${{ vars.SSH_HOST }}:public_html/reports/tr35/tr35-${{ steps.metadata.outputs.revision }}/
- name: Upload revision
run: |
echo "- Production: https://unicode.org/reports/tr35/tr35-${{ steps.metadata.outputs.revision }}/tr35.html" | tee -a $GITHUB_STEP_SUMMARY
- name: Sync versions to server
if: github.ref == 'refs/heads/main'
run: |
rsync -c --verbose --verbose \
tr35-versions.yml \
${{ vars.SSH_HOST }}:etc/
- name: Execute link update on versions
if: github.ref == 'refs/heads/main'
run: ssh ${{ vars.SSH_HOST }} python3 bin/tr35-links.py etc/tr35-versions.yml link --dir ./public_html/reports/tr35/
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true