From b979f8a130adbe94061ca657aa0e9b1ba031691f Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:21:31 +0100 Subject: [PATCH 1/7] GHA to create issue on new IANA release --- .github/workflows/tz_update_check.yml | 41 +++++++++++++++++++++++++++ TZ_RELEASE | 1 + 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/tz_update_check.yml create mode 100644 TZ_RELEASE diff --git a/.github/workflows/tz_update_check.yml b/.github/workflows/tz_update_check.yml new file mode 100644 index 0000000..9195119 --- /dev/null +++ b/.github/workflows/tz_update_check.yml @@ -0,0 +1,41 @@ +name: Check for new IANA release + +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: + +jobs: + check_tz: + name: Check latest IANA release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Run script + env: + WORKFLOW_RUN_ID: ${{ github.run_id }} + run: | + set -e + + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + latest_tag=$(curl --silent -L -H "Accept: application/vnd.github+json" https://api.github.com/repos/eggert/tz/tags | jq -r '.[0].name') + current_tag=$(cat TZ_RELEASE) + + if [[ $latest_tag == $current_tag ]]; then + echo "tz up to date" + exit 0 + fi + + echo "New tz release available: ${latest_tag}" + + # create issue with new release + body=$(echo "IANA released ${latest_tag}. See [here](https://github.com/eggert/tz/blob/main/NEWS) for the latest changes made to tz.\ + Created by workflow run [#${WORKFLOW_RUN_ID}](https://github.com/evansiroky/timezone-boundary-builder/actions/runs/${WORKFLOW_RUN_ID})." | xargs) + gh issue create --title "IANA Release ${latest_tag}" --body "${body}" + + exit 1 diff --git a/TZ_RELEASE b/TZ_RELEASE new file mode 100644 index 0000000..cd9c3f6 --- /dev/null +++ b/TZ_RELEASE @@ -0,0 +1 @@ +2023d From ea881a973c7ee71d903d8fe8c98d24bf4ffd9483 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:22:39 +0100 Subject: [PATCH 2/7] test on this branch --- .github/workflows/tz_update_check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tz_update_check.yml b/.github/workflows/tz_update_check.yml index 9195119..3b05843 100644 --- a/.github/workflows/tz_update_check.yml +++ b/.github/workflows/tz_update_check.yml @@ -4,6 +4,9 @@ on: schedule: - cron: "0 0 * * 0" workflow_dispatch: + push: + branches: + - nn-gha-tz-update jobs: check_tz: From 7ee4103729a17a205ea07801aa96a78005ce91e2 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:25:35 +0100 Subject: [PATCH 3/7] try to trigger CI again From d16ba02daeb4fc564f436a85a7ca2d6ad41518b3 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:27:16 +0100 Subject: [PATCH 4/7] needs those env vars apparently --- .github/workflows/tz_update_check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tz_update_check.yml b/.github/workflows/tz_update_check.yml index 3b05843..65503db 100644 --- a/.github/workflows/tz_update_check.yml +++ b/.github/workflows/tz_update_check.yml @@ -19,7 +19,9 @@ jobs: - name: Run script env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} WORKFLOW_RUN_ID: ${{ github.run_id }} + WORKFLOW_JOB_ID: ${{ github.job }} run: | set -e From d252e544a6e113cd959fd17882c7a9eb144ab497 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:28:37 +0100 Subject: [PATCH 5/7] try to trigger CI again From 9b6780b98fc32b21050514793479912fd2e56933 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:29:55 +0100 Subject: [PATCH 6/7] test success, remove branch againi --- .github/workflows/tz_update_check.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tz_update_check.yml b/.github/workflows/tz_update_check.yml index 65503db..32b1049 100644 --- a/.github/workflows/tz_update_check.yml +++ b/.github/workflows/tz_update_check.yml @@ -4,9 +4,6 @@ on: schedule: - cron: "0 0 * * 0" workflow_dispatch: - push: - branches: - - nn-gha-tz-update jobs: check_tz: From 58601ee6d12cdfbf76c5a150ed8b52be6172f629 Mon Sep 17 00:00:00 2001 From: nilsnolde Date: Fri, 8 Mar 2024 21:33:30 +0100 Subject: [PATCH 7/7] add space --- .github/workflows/tz_update_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tz_update_check.yml b/.github/workflows/tz_update_check.yml index 32b1049..a006524 100644 --- a/.github/workflows/tz_update_check.yml +++ b/.github/workflows/tz_update_check.yml @@ -36,7 +36,7 @@ jobs: echo "New tz release available: ${latest_tag}" # create issue with new release - body=$(echo "IANA released ${latest_tag}. See [here](https://github.com/eggert/tz/blob/main/NEWS) for the latest changes made to tz.\ + body=$(echo "IANA released ${latest_tag}. See [here](https://github.com/eggert/tz/blob/main/NEWS) for the latest changes made to tz. \ Created by workflow run [#${WORKFLOW_RUN_ID}](https://github.com/evansiroky/timezone-boundary-builder/actions/runs/${WORKFLOW_RUN_ID})." | xargs) gh issue create --title "IANA Release ${latest_tag}" --body "${body}"