diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index f0fa64186..890e56758 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -9,13 +9,30 @@ 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 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 + + - 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)