Skip to content

Fix: prevent_self_review breaks all environment creation via .asf.yaml#101

Open
andrewmusselman wants to merge 1 commit into
apache:mainfrom
andrewmusselman:fix-prevent-self-review-env-creation
Open

Fix: prevent_self_review breaks all environment creation via .asf.yaml#101
andrewmusselman wants to merge 1 commit into
apache:mainfrom
andrewmusselman:fix-prevent-self-review-env-creation

Conversation

@andrewmusselman

Copy link
Copy Markdown

Gotten this email message on two separate repos when setting up Trusted Publishing for PyPi and merging a new version of .asf.yaml setting up an environment pypi, first on apache/tooling-asfswhid and just now on apache/mahout:

mahout.git: Error while running github feature from main:.asf.yaml
[Mahout/dev]
Apache Infrastructure
12:06 AM (26 minutes ago)
to jiekaichang, commits
An error occurred while processing the github feature in .asf.yaml:

Repository.create_environment() got an unexpected keyword argument 'prevent_self_review'

---
With regards, ASF Infra.
For further information, please see the .asf.yaml documentation at:
https://github.com/apache/infrastructure-asfyaml/blob/main/README.md

create_environment() always passes prevent_self_review=True (the default) to PyGithub's Repository.create_environment(), but the installed PyGithub version does not support that parameter, causing a TypeError that prevents any deployment environment from being created.

This patch:

  • Defaults prevent_self_review to None instead of True (only pass when explicitly set in .asf.yaml)
  • Falls back gracefully if PyGithub raises TypeError on the parameter, retrying without it

create_environment() always passes prevent_self_review=True (the default)
to PyGithub's Repository.create_environment(), but the installed PyGithub
version does not support that parameter, causing a TypeError that prevents
any deployment environment from being created.

This patch:
- Defaults prevent_self_review to None instead of True (only pass when
  explicitly set in .asf.yaml)
- Falls back gracefully if PyGithub raises TypeError on the parameter,
  retrying without it
@andrewmusselman

Copy link
Copy Markdown
Author

I realized I hadn't specified the symptom in the trusted publishing workflow, which is we tag a release in git and push to github, and after ci/cd, the artifacts get sent to pypi without a maintainer approval gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants