API: Link Repositories to Organizational Projects

Hello,

I am trying to speed organization level project management with some automation, but don’t see a method to link repositories[1] to the project. Can someone point me in the right direction, or can we add this as a feature request?

[1]

Hi there @sumarlidason hope you’re doing well!

We definitely have this capability via our GraphQL API:

Our REST API for repos has a boolean has_projects which can be true or false:

…but after some searching, I don’t believe a REST option for the same exists.

Though your suggestion that this could be elevated as a Feature Request is an excellent one! We have this form:

…for exactly this reason.

Ps., I love your av!

Thanks for the sanity check! will do! :pray: :raised_hands: :raised_hands:

1 Like

BTW: there’s no way (or I can’t find one) to check if the repository is already linked to organization project. I’m using the very mutation you linked but in case the repo is already linked it fails with

Validation failed: Project A link already exists between this project and repository.

I’d gladly exclude that mutation from being executed it it was only possible to tell whether the link already exists or not.

Hey @jrencz! Thanks so much for elevating this limitation. You’re :100:% correct, and I also see that you’ve opened an internal ticket with us to discuss as well.

I hope that it’s kosher to reveal your own workaround, as documented in the aforementioned ticket:

I figured out a workaround for may problem which will work just in Actions where I need it: use unlinkRepositoryFromProject combined with option continue-on-error: true

So in-lieu of some value/attribute that declares an existing link, we have our feedback form:

…that I would suggest anyone reading this to submit, who might be trying to solve for similar. The more submissions on the same request, the better!

1 Like