Import from IANA #21891
This file contains 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: Import from IANA | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
- cron: '10 * * * *' # every hour at *:10 | |
workflow_dispatch: | |
jobs: | |
import: | |
name: Import ${{ matrix.target }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- source: assignments | |
target: registries | |
- source: tz | |
target: timezone | |
steps: | |
- name: Checkout iana-${{ matrix.target }} repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ietf-tools/iana-${{ matrix.target }} | |
token: ${{ secrets.IETF_BIB_BOT_PAT_IANA }} | |
path: iana-${{ matrix.target }} | |
- name: Setup Git | |
run: | | |
git config --global user.name ietf-bib-bot | |
git config --global user.email [email protected] | |
- name: Add GitHub remote to repo | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
git remote set-url origin \ | |
https://ietf-bib-bot:${{ secrets.IETF_BIB_BOT_PAT_IANA }}@github.com/ietf-tools/iana-${{ matrix.target }} | |
- name: Perform rsync from IANA | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
rsync -avciz --delete-before \ | |
--exclude '.git*' \ | |
--exclude 'README' \ | |
--exclude 'README.*' \ | |
rsync.iana.org::${{ matrix.source }} . | |
- name: Git diff | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
git diff | |
- name: Skip the rest if no changes | |
id: git_status | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
echo ::set-output name=STATUS::$(git status --porcelain | tr -d [:space:]) | |
- name: Add changes | |
if: steps.git_status.outputs.STATUS != '' | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
git add -A | |
git commit -m "$(date -R -u)" | |
- name: Git log | |
if: steps.git_status.outputs.STATUS != '' | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
git log | head -100 | |
- name: Git push to GitHub iana-${{ matrix.target }} | |
if: steps.git_status.outputs.STATUS != '' | |
working-directory: iana-${{ matrix.target }} | |
run: | | |
git push --all -f | |
git push --tags -f | |
workflowKeepalive: | |
name: Keep workflow alive | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Keeping the GHA workflow alive | |
- uses: gautamkrishnar/keepalive-workflow@v1 | |
with: | |
committer_username: ietf-bib-bot | |
committer_email: [email protected] |