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

Cannot create a repo webhook for a repo within an organization using github.RepositoryWebhook #530

Closed
Kody-Quintana opened this issue Dec 31, 2023 · 1 comment
Labels
kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team

Comments

@Kody-Quintana
Copy link

Kody-Quintana commented Dec 31, 2023

What happened?

The repository attribute of github.RepositoryWebhook implicitly prefixes the url of the git repository with the url of your personal github account. Making it impossible to create a webhook for an organization repository.

Example

github.RepositoryWebhook(
    'my-webhook',
    repository="my-org-name/org-repo",
    configuration={
        'url': "my-url",
        'secret': "my-token",
        'content_type': "json",
    },
    events=[
        "release"
    ]
)

results in this error:

Diagnostics:
  github:index:RepositoryWebhook (my-webhook):
    error: POST https://api.github.com/repos/my-personal-github-account/my-org-name/org-repo/hooks: 404 Not Found []

Output of pulumi about

CLI          
Version      3.99.0
Go Version   go1.21.5
Go Compiler  gc

Plugins
NAME        VERSION
aws         6.15.0
github      5.23.0
kubernetes  3.30.1
linode      3.12.0
python      unknown
random      4.13.2

Host     
OS       arch
Version  "rolling"
Arch     x86_64

This project is written in python: executable='/usr/bin/python3' version='3.11.6'

Additional context

I'm aware of github.OrganizationWebhook but that does not seem to have a way to specify a single repository within an organization.

How can I create a webhook for a specific org repo?

I thought that this issue may be related to using a personal token, but according to this stackoverflow post an "org level" token is not possible to create

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@Kody-Quintana Kody-Quintana added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Dec 31, 2023
@Kody-Quintana
Copy link
Author

Kody-Quintana commented Dec 31, 2023

I was able to achieve this via setting the organization value in a provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team
Projects
None yet
Development

No branches or pull requests

1 participant