Skip to content

Simple GitHub Webhook Azure Function which maintains the list of topics in a GitHub repository. Reads file extensions of source code files in the last commit of the GitHub repo which are mapped to set topics.

License

Notifications You must be signed in to change notification settings

johnt84/GitHubWebHookTool

Repository files navigation

GitHub Webhook Azure Function

Simple GitHub Webhook Azure Function

Maintains topics in a GitHub repository by reading file extensions of source code files in the last commit of the GitHub repo which are mapped to set topics.

  • GitHub Webhook which listens for new commits (git push)
  • It maintains the list of topics on a GitHub repository by obtaining the file extensions in the last commit and then updating the topics in the GitHub repository based on the last commit. For example if the last commit contains a file with a .cs extension then the Azure Function will ensure that csharp is added as a topic on the GitHub repository using the GitHub api
  • The current file extension to topic mappings (shown below) is stored in appsettings.json
  • Developed with Azure Functions 4.0/.Net 6
  • Contains a unit test app which uses MS Test .Net 6 and utilises the Moq 4.16 library to unit test the push service
  • There is also AWS Lambda Function versions of the GitHub WebHook which are:-
    • AWS Lamda Function
    • AWS Serverless API Function
  • The GitHub WebHook Azure Function and AWS Lambda Functions utilise:
    • Shared GitHubWebHookEngine Class Library (.Net 6)
    • Shared Models Class Library (.Net 6)
File Extension Topic
aspx web-forms
cs csharp
js javascript
razor blazor-server
sql tsql

Example update

GitHub Repo with one topics before update

image

Last commit with one mapped Topic of C#

Two file extensions of .cs and .json in last commit but only .cs is mapped to one of the set topics which is the csharp topic.

image

Postman Request and Response showing updated list of topics on GitHub repo

GitHubWebHookTool maintains the list of current topics and adds any extra topics not already in the current list of topics in the repo. Therefore in this example where there was already an existing topic of football-data then the csharp topic is added to the list of topics for this GitHub repo.

image

Repo with C# topics after update

image

About

Simple GitHub Webhook Azure Function which maintains the list of topics in a GitHub repository. Reads file extensions of source code files in the last commit of the GitHub repo which are mapped to set topics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages