Update Phone Metadata #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Phone Metadata | |
| on: | |
| schedule: | |
| - cron: '0 6 * * 1' # Every Monday at 06:00 UTC | |
| workflow_dispatch: # Manual trigger | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Download latest PhoneNumberMetadata.xml | |
| run: | | |
| curl -sfL --retry 3 --retry-delay 5 -o PhoneNumberMetadata.xml \ | |
| https://raw.githubusercontent.com/google/libphonenumber/master/resources/PhoneNumberMetadata.xml | |
| - name: Extract metadata to JSON | |
| run: node build/extract.mjs PhoneNumberMetadata.xml | |
| - name: Check for changes | |
| id: check | |
| run: | | |
| git diff --quiet phone-metadata.json && echo "changed=false" >> $GITHUB_OUTPUT || echo "changed=true" >> $GITHUB_OUTPUT | |
| - name: Commit and push | |
| if: steps.check.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add phone-metadata.json | |
| git commit -m "Update phone metadata $(date +%Y-%m-%d)" | |
| git push |