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

Add two convenience scripts #50

Merged
merged 2 commits into from
Dec 17, 2023

Conversation

dscho
Copy link
Member

@dscho dscho commented Nov 22, 2023

These scripts are meant for local use, i.e they are not intended to be run on the server side.

Every once in a while, somebody installs the GitForWindowsHelper GitHub
App on their repository.

Seeing as we have checks that ensure that only webhook events from the
intended repositories are handled, this does not affect those
repositories at all.

However, it does send a ton of webhook events to those repositories, and
when I go looking in
https://github.com/organizations/git-for-windows/settings/apps/gitforwindowshelper/advanced
for any specific delivery (e.g. to see the response from the Azure
Function App in case something went wrong), it is incredibly tedious to
click "Load more deliveries" a thousand times until I finally get to the
interesting webhook event delivery.

Let's avoid that by simply running (manually) this script from time to
time, to uninstall the App on unintended repositories, to avoid those
unnecessary and unwanted webhook deliveries.

This script requires the same `local.settings.json` file as is needed
for testing the Azure Function locally (for details, refer to
`README.md#run-the-azure-function-locally`); That is where it gets the
credentials required to perform the uninstallations.

Signed-off-by: Johannes Schindelin <[email protected]>
In the previous commit, I added a script to delete existing
installations of the GitForWindowsHelper GitHub App for unintended
repositories, to avoid cluttering the list of webhook deliveries.

I ran this script a couple times in the past, but it was always a bit
late for that because I had to click literally over 200 times on that
button just to get to payloads that were delivered two days prior.

A better way is to use the GitHub REST API to let a script search for
specific deliveries, say, for a `check_run` that has completed around a
given time.

I used this script today to great effect to find the `check_run` and
`workflow_job` webhook payloads that I mentioned in
git-for-windows/git-for-windows-automation#60

It uses a bit of an ad-hoc strategy to avoid having to load sequential
pages of deliveries until the desired time window is reached. That
strategy could probably be improved, but it seems to work well enough
for now.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho self-assigned this Nov 22, 2023
@dscho dscho merged commit d0bc49c into git-for-windows:main Dec 17, 2023
1 check passed
@dscho dscho deleted the add-convenience-scripts branch December 17, 2023 10:42
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.

1 participant