From f9e5f7f86fb8bf2d8bf0cff642131368f0ac6259 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:11:15 +0100 Subject: [PATCH 1/2] Split dependencies and check steps --- .github/workflows/upstream.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index f0fa64186..bdb2c7607 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -14,8 +14,11 @@ jobs: - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4 with: python-version: 3 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install requests + - name: Check upstream version run: | - pip install -U pip - pip install requests - python3 tools/python/checkupstreamversion.py + python tools/python/checkupstreamversion.py From aa55b5a2ab06edfb19f0834939471049b08fe00e Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:13:57 +0100 Subject: [PATCH 2/2] Add create-issue step --- .github/workflows/upstream.yml | 14 ++++++++++++++ tools/python/checkupstreamversion.py | 1 + 2 files changed, 15 insertions(+) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index bdb2c7607..890e56758 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -9,6 +9,8 @@ jobs: versioncheck: runs-on: ubuntu-latest if: github.repository_owner == 'daviddrysdale' + permissions: + issues: write steps: - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4 @@ -22,3 +24,15 @@ jobs: - name: Check upstream version run: | python tools/python/checkupstreamversion.py + + - name: Create update issue + if: failure() + uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 + with: + # language=JavaScript + script: | + await github.rest.issues.create({ + owner: "daviddrysdale", + repo: "python-phonenumbers", + title: `[bot]: New upstream version: ${process.env.LIBPHONENUMBER_UPSTREAM_VERSION}`, + }) diff --git a/tools/python/checkupstreamversion.py b/tools/python/checkupstreamversion.py index e517ffa44..79f1603b8 100755 --- a/tools/python/checkupstreamversion.py +++ b/tools/python/checkupstreamversion.py @@ -44,4 +44,5 @@ print( f"Local version {local_version} does not match upstream version {upstream_version}" ) + os.environ["LIBPHONENUMBER_UPSTREAM_VERSION"] = upstream_version raise SystemExit(1)