From 8cb4566b7336f33fbfc06401c1bebc5fcf974417 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 08:42:07 -0700 Subject: [PATCH 1/7] =?UTF-8?q?Update=20geo-data,=20T=C3=BCrkiye?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changelog/c981d53176e142ba94d885a13e608faa.md | 4 ++++ octodns/record/geo_data.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .changelog/c981d53176e142ba94d885a13e608faa.md diff --git a/.changelog/c981d53176e142ba94d885a13e608faa.md b/.changelog/c981d53176e142ba94d885a13e608faa.md new file mode 100644 index 0000000..67d5bb5 --- /dev/null +++ b/.changelog/c981d53176e142ba94d885a13e608faa.md @@ -0,0 +1,4 @@ +--- +type: minor +--- +Update geo-data, Türkiye \ No newline at end of file diff --git a/octodns/record/geo_data.py b/octodns/record/geo_data.py index d78eabf..dfbe75f 100644 --- a/octodns/record/geo_data.py +++ b/octodns/record/geo_data.py @@ -123,7 +123,7 @@ geo_data = { 'TJ': {'name': 'Tajikistan'}, 'TL': {'name': 'Timor-Leste'}, 'TM': {'name': 'Turkmenistan'}, - 'TR': {'name': 'Turkey'}, + 'TR': {'name': 'Türkiye'}, 'TW': {'name': 'Taiwan, Province of China'}, 'UZ': {'name': 'Uzbekistan'}, 'VN': {'name': 'Viet Nam'}, From 117c14cc9646fbac22216326150e2d3f4e696ca0 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 09:54:07 -0700 Subject: [PATCH 2/7] A pass at a cron action to auto-generate update PRs to geo-data --- .../72ba948357fb41ea948a25b8c8454131.md | 4 ++ .github/workflows/geo-data.yml | 55 +++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .changelog/72ba948357fb41ea948a25b8c8454131.md create mode 100644 .github/workflows/geo-data.yml diff --git a/.changelog/72ba948357fb41ea948a25b8c8454131.md b/.changelog/72ba948357fb41ea948a25b8c8454131.md new file mode 100644 index 0000000..2e83193 --- /dev/null +++ b/.changelog/72ba948357fb41ea948a25b8c8454131.md @@ -0,0 +1,4 @@ +--- +type: none +--- +Cron action for geo-data.py \ No newline at end of file diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml new file mode 100644 index 0000000..b6afa3a --- /dev/null +++ b/.github/workflows/geo-data.yml @@ -0,0 +1,55 @@ +name: Update geo_data.py +on: + workflow_dispatch: # option to run manually if/when needed + schedule: + - cron: "42 3 * * 6" # sat @ 3:42am + +jobs: + config: + runs-on: ubuntu-latest + outputs: + json: ${{ steps.load.outputs.json }} + steps: + - uses: actions/checkout@v4 + - id: load + # based on https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + run: | + { + echo 'json<> $GITHUB_OUTPUT + update-geo-data: + needs: config + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup python + uses: actions/setup-python@v4 + with: + python-version: ${{ fromJson(needs.config.outputs.json).python_version_current }} + architecture: x64 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install virtualenv + - name: Generate geo_data.py + run: | + source env/bin/activate + ./script/generate-geo-data > octodns/record/geo_data.py + [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.PAT }} + commit-message: Periodic updates to geo_data.py + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> + signoff: false + branch: update-geo-data + delete-branch: true + title: 'Update geo data to reflect recent changes' + body: Auto-generated with https://github.com/peter-evans/create-pull-request + draft: false From 2e082425857a90ff94471dec959786a0c682ee86 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 10:02:11 -0700 Subject: [PATCH 3/7] don't need to activate env, there isn't one --- .changelog/3e80c9a9167b4d0ea3eb95f8b46b177a.md | 4 ++++ .github/workflows/geo-data.yml | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changelog/3e80c9a9167b4d0ea3eb95f8b46b177a.md diff --git a/.changelog/3e80c9a9167b4d0ea3eb95f8b46b177a.md b/.changelog/3e80c9a9167b4d0ea3eb95f8b46b177a.md new file mode 100644 index 0000000..c637a10 --- /dev/null +++ b/.changelog/3e80c9a9167b4d0ea3eb95f8b46b177a.md @@ -0,0 +1,4 @@ +--- +type: none +--- +Fixes for geo-data.py action \ No newline at end of file diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml index b6afa3a..02192b8 100644 --- a/.github/workflows/geo-data.yml +++ b/.github/workflows/geo-data.yml @@ -36,7 +36,6 @@ jobs: pip install virtualenv - name: Generate geo_data.py run: | - source env/bin/activate ./script/generate-geo-data > octodns/record/geo_data.py [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py - name: Create Pull Request From 9bd32e003fcf99a4ecaa4018e96abf1d5b49e695 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 10:07:30 -0700 Subject: [PATCH 4/7] actually forgot to bootstrap --- .github/workflows/geo-data.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml index 02192b8..cecd768 100644 --- a/.github/workflows/geo-data.yml +++ b/.github/workflows/geo-data.yml @@ -36,6 +36,8 @@ jobs: pip install virtualenv - name: Generate geo_data.py run: | + ./script/bootstrap + source env/bin/activate ./script/generate-geo-data > octodns/record/geo_data.py [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py - name: Create Pull Request From f34d4e935435f3815d2c8099d850a5be6102d3b6 Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 10:11:04 -0700 Subject: [PATCH 5/7] Avoid exit 1 if there are no changes --- .github/workflows/geo-data.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml index cecd768..c682a51 100644 --- a/.github/workflows/geo-data.yml +++ b/.github/workflows/geo-data.yml @@ -39,7 +39,7 @@ jobs: ./script/bootstrap source env/bin/activate ./script/generate-geo-data > octodns/record/geo_data.py - [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py + [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py || true - name: Create Pull Request id: cpr uses: peter-evans/create-pull-request@v7 From f0af54e725823fa2e9cbab274cb1156c4838e9fe Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 10:23:52 -0700 Subject: [PATCH 6/7] print out the diff --- .github/workflows/geo-data.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml index c682a51..30005f9 100644 --- a/.github/workflows/geo-data.yml +++ b/.github/workflows/geo-data.yml @@ -39,6 +39,7 @@ jobs: ./script/bootstrap source env/bin/activate ./script/generate-geo-data > octodns/record/geo_data.py + git diff [ `git status --porcelain=1 | wc -l` -ne 0 ] && ./script/changelog create -t minor Periodic updates to geo_data.py || true - name: Create Pull Request id: cpr From f2189b2149478b299cb28bc24961f254227cac0b Mon Sep 17 00:00:00 2001 From: Ross McFarland Date: Thu, 19 Jun 2025 10:24:16 -0700 Subject: [PATCH 7/7] simplify and clean up params for create pr step --- .github/workflows/geo-data.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/geo-data.yml b/.github/workflows/geo-data.yml index 30005f9..a1249ec 100644 --- a/.github/workflows/geo-data.yml +++ b/.github/workflows/geo-data.yml @@ -45,13 +45,7 @@ jobs: id: cpr uses: peter-evans/create-pull-request@v7 with: - token: ${{ secrets.PAT }} commit-message: Periodic updates to geo_data.py - committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> - author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> - signoff: false branch: update-geo-data - delete-branch: true - title: 'Update geo data to reflect recent changes' + title: Update geo_data.py to reflect recent changes body: Auto-generated with https://github.com/peter-evans/create-pull-request - draft: false