Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically open an issue on a new upstream release #280

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this create a new issue on every failed run of the workflow?

I'm thinking that if I'm away for a week and a release happens to come out at the start, would I return to 14 identical issues? :-)

owner: "daviddrysdale",
repo: "python-phonenumbers",
title: `[bot]: New upstream version: ${process.env.LIBPHONENUMBER_UPSTREAM_VERSION}`,
})
1 change: 1 addition & 0 deletions tools/python/checkupstreamversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
print(
f"Local version {local_version} does not match upstream version {upstream_version}"
)
os.environ["LIBPHONENUMBER_UPSTREAM_VERSION"] = upstream_version
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work – IIRC environment variables are only visible to child processes, not parents.

raise SystemExit(1)