How to manually re-add webhook to public repo in a GitHub organization

Description

When the webhook to Codecov.io is (mistakenly) removed in a public GitHub repo what is the easiest way to get it back? Preferably for a maintainer of the repo which does not have org permission to manage Codecov GitHub app. :slight_smile:

Repository

Versions

not applicable

Additional Information

None

We were doing fine up to this part. :wink:

Assuming you have access to add a webhook, I wonder if revoking your OAuth and signing back to Codecov would do it. Failing that, you may need to look into settings a team bot https://docs.codecov.io/docs/team-bot

Let me know if either of those work.

Since CodeCov wasn’t working for us using Pester <=v4.9 have removed it in some repos. Now that it works we need to readd it again. :wink:

Maintainers do have the right to add webhooks, they are admins on the repos. But not finding any OAuth to remove. :thinking:
In Codecov.io it says in https://codecov.io/gh/dsccommunity/ActiveDirectoryDsc/settings

Codecov uses GitHub Webhooks to keep in sync with your project.

A webhook has been enabled through GitHub Integrations. No setup required.

I do have org permission to manage the GitHub App. Is there are an easy way for me to re-add the webhook in all repos that currently missing it? But I was hoping there was a way for the maintainers to just add the webhook to the GitHub repo settings webhook page. :slightly_smiling_face:

I rather not use the Team Bot since GitHub App works perfectly. :slightly_smiling_face:

You can try using the API https://docs.codecov.io/v4.4.0/reference#section-activate-repository to activate it, that may put the webhook back. I’m not sure without doing a code dive, which I don’t have the bandwidth for currently. (will add to my list if that doesn’t work, though)

I tried but the result was:

{"meta": {"status": 400}, "error": {"reason": "You may only activate private repositories.", "context": null}}

Just noticed that on the repo settings on Codecov there should be a button to create the web hook back, do you see that?

I can’t see a button that would do that. I browse to https://codecov.io/gh/dsccommunity/ActiveDirectoryDsc/settings and under the “Genaral” tab there are a section “GitHub Webhook”, but it only have this text:

Codecov uses GitHub Webhooks to keep in sync with your project.

A webhook has been enabled through GitHub Integrations. No setup required.

Arg. Apparently my view is messing with me today.

It’s looking like the only solution is getting an org admin to toggle the app on GitHub, but I’m still looking for another solution.

The maintainer is currently adding the necessary steps to the pipeline to upload reports to Codecov.io. We will see if that will trigger the re-creation of the webhook (by the report is uploaded). Curious if the webhook is not needed when we have the GitHub App? Maybe the webhook in the other repos are something old before the GitHub App existed?

Based on the wording, I think it may be. I’d try uploading and see if things work correctly without it.

It did upload correctly and it posted back to the PR:

Just wondering now if we loose any functionality without the webhook. :thinking: Though, if we do not need the webhook that is even better! :smiley:

Codecov: https://codecov.io/gh/dsccommunity/ActiveDirectoryDsc/pulls

Tried upload from a newer repository:

It seems it uploaded the file:
https://dev.azure.com/dsccommunity/DscResource.DocGenerator/_build/results?buildId=925&view=logs&j=9c98dabf-a506-5435-4ead-dace7c1625a8&t=c251aece-c156-5cd3-dcec-645d5e596fc0

But on Codecov.io the PR does not show:
https://codecov.io/gh/dsccommunity/DscResource.DocGenerator/pulls

You have an indenting issue around notify: :wink:

The primary issue though, is that you need to path fix source into your report path so we can match them: codecov.io/codecov/v4/raw/2020-02-06/9963E6B16D988752FF8A7954F7660322/1d2365084d7b11042153679662cc354d384ac177/2254755a-aa49-4eeb-91b4-f3a4fda5c929.txt

Ah, notify should not be part of Codecov.yml since we don’t use the properties under it. :thinking:
I just realized too that it was a bad repository to test with since that have the folder structure totally different than the others. :confused: I will try with another one in a bit. :slightly_smiling_face:

1 Like

I update this repo (PR) as well, and it seems to work without the webhook. So this might have been a non-issue. :thinking: :smile:

1 Like

You mean the note that “webhooks aren’t needed when using the app” might be true? :woman_facepalming:

(to be 100% clear, I’m facepalming myself, not you. Very happy it’s working correctly) :smiley:

Haha. Sorry I took you down the rabbit hole. :wink:

All good :slight_smile: