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

Support for Environments + Environment secrets #2067

Closed
anovis opened this issue Sep 30, 2021 · 11 comments · Fixed by #2848
Closed

Support for Environments + Environment secrets #2067

anovis opened this issue Sep 30, 2021 · 11 comments · Fixed by #2848

Comments

@anovis
Copy link

anovis commented Sep 30, 2021

Would be nice to have support for environment secrets or environments in general

https://docs.github.com/en/rest/reference/repos#environments

https://docs.github.com/en/rest/reference/actions#get-an-environment-secret

@Adib234
Copy link

Adib234 commented Jan 5, 2022

Hi, I would like to tackle this feature request. The first link appears to be invalid, I've tried searching the environments section and got nothing. My approach to this would be to create a method in the Repository class for the management of environment secrets, I originally planned on having an Environment class but there seems to be not that much information about environments other than handling environment secrets in the Github API docs. I would like some feedback and any information that I should be aware of.

@tomkennes
Copy link

HI there, thumbs up for this feature! Any update @Adib234 ? Or is there anything I can do to help out?

@Adib234
Copy link

Adib234 commented Jan 24, 2022

Hi, I'm not working on this feature anymore since life got in the way, it's all yours!

@alson
Copy link
Contributor

alson commented Apr 20, 2022

I needed environments, so I have added support for environments, but not environment secrets. It should be easy to add support for environment secrets on top of this. Also, if necessary help with getting this PR ready and merged by someone more experienced in this project would be appreciated.

@sandesvitor
Copy link

This feature is great @alson , it would be awesome if it got approved! Me and my team are in need for environment creation to be used as Stackstorm Github Exchange

@lukaszraczylo
Copy link

@alson would you kindly try rebasing your code? Can't wait for it to be merged

@alson
Copy link
Contributor

alson commented Nov 23, 2022

@lukaszraczylo Of course, I just pushed a version rebased on top of the latest PyGithub master.

@jfair9
Copy link

jfair9 commented Aug 1, 2023

Any examples of how to use the new environment feature to add Deployment Branch rule using the branch name pattern?

image

@alson
Copy link
Contributor

alson commented Aug 1, 2023

If the branch you want to limit deployment to is covered by branch protection rules, then setting protected_branches=True like in this test might work. See documentation under "properties of deployment_branch_policy". If not, then you might have to implement deployment branch policies.

The way we solved this is by just specifying branches in the Github Actions workflow and let that determine to what environment a particular branch is deployed. We are not so defensive that we want to protect against developers modifying the workflow to deploy their development branch to production.

@ssbarnea
Copy link
Contributor

Does anyone know an alternative way to update secrets from environments using python, even if this requires use of another library or just producing REST HTTP api call manually?

@alson
Copy link
Contributor

alson commented Sep 12, 2023

You should be able to use the REST calls documented here. I don't think it would be difficult to add to PyGithub.

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

Successfully merging a pull request may close this issue.

9 participants