GitHub automation for my repositories.
The following workflows are available.
Workflow | Description |
---|---|
acr-housekeeping | Deletes old container images in Azure Container Registry. |
dotnet-dependencies-updated | Runs the rebase workflow for a repository when its dependencies are determined to have changed. |
dotnet-bumper | Runs .NET Bumper and generates a pull request to update the .NET version used in a repository. |
dotnet-release | Runs every 15 minutes to check for new official releases of the .NET SDK. |
dotnet-upgrade-report | Runs daily to produce a report for a specified branch used for testing .NET vNext. |
dotnet-upgrade-report-for-nightly | Runs daily to produce a report for a specified branch used for testing .NET vNext using .NET daily builds. |
dotnet-version-report | Generates a report of the .NET SDK versions used by the default branch of my repositories. |
is-dotnet-change-available | Determines whether the changes from a pull request are available in a .NET installer build |
issue-metrics | Runs monthly to generate a report of metrics for issues and pull requests for my repositories. |
nuget-packages-published | Waits for one or more NuGet packages to be published and then comments on issues/PRs associated with their milestone. |
rebase | Rebases a branch of one or more repositories onto a specified base branch. |
rebase-pull-request | Rebases a pull request onto the default branch of a repository in response to a comment on the pull request. |
update-docker-dependencies | Checks for new versions of uses: docker:// -format Actions and generates pull requests to update them. |
update-dotnet-sdks | Runs the update-dotnet-sdk workflow for one or more repositories for a specified branch. |
update-dotnet-sdks-for-nightly | Runs the update-dotnet-sdks workflow daily for the dotnet-nightly branch. |
update-github-dependencies | Checks for new versions of GitHub projects and updates environment variables containing their version. |
update-static-assets | Checks for new releases of static HTML assets served from cdnjs and generates pull requests to update them. |
The dotnet-dependencies-updated workflow
is triggered when a repository_dispatch
event is received for the dotnet_dependencies_updated
event type. The workflow then runs the rebase workflow for the
repository specified in the payload.
{
"event_type": "dotnet_dependencies_updated",
"client_payload": {
"repository": "owner/repository",
"ref": "main",
"sha": "{git commit sha}"
}
}
The repository_dispatch
events are created by Costellobot.
The dotnet-release workflow runs every 15 minutes to
check if any changes have been made to the release-notes/**/*.json
files
in the dotnet/core repository.
If changes are detected that may signify a new release of the .NET SDK is available,
then the workflow will create a repository_dispatch
event for the dotnet_release
event type.
{
"event_type": "dotnet_release",
"client_payload": {
"branch": "(main|dotnet-vnext)"
}
}
The event is only dispatched for the dotnet-vnext
branch if the support-phase
of
any new SDK released for a given release channel is either preview
or go-live
.
The dotnet-upgrade-report workflow runs daily and generates
a markdown report that finds all of the open pull requests against a given branch,
by default the dotnet-vnext
branch, and then checks if the pull request is using the
latest version of the .NET SDK for the relevant .NET release, whether the CI is passing
and whether the pull request has any merge conflicts.
For the dotnet-vnext
branch, the report content will also be updated in this Gist.
The dotnet-version-report workflow runs on-demand and generates a markdown report that finds all of the repositories owned by the configured GitHub Personal Access Token (PAT) and shows which .NET SDK versions are used by the default branch of each of the repositories and whether that version is the latest official release.
The is-dotnet-change-available workflow is run manually to determine whether the changes from a pull request to a .NET repository have flowed into a daily build of the .NET SDK from the dotnet/sdk repository.
The issue-metrics workflow runs monthly and generates a markdown report about the issues and pull requests for the repositories owned by the configured GitHub Personal Access Token (PAT) using the github/issue-metrics action.
The rebase workflow rebases a branch of all of the repositories in the configured owner onto the default branch of the repository.
The Rebaser action is used to rebase the branch. Rebaser will attempt to resolve conflicts for versions of the .NET SDK, NuGet packages and npm packages automatically by always preferring the highest version number.
If the conflicts in a rebase cannot be automatically resolved, then it will be aborted and it will need to be manually dealt with.
To manually resolve the conflicts, you can checkout the rebaser repository locally and run the following commands to interatively rebase the branch locally using the action using Node.js and Visual Studio Code.
# First checkout the repository you wish to rebase locally, and then checkout
# the branch you wish to rebase and ensure it is in sync with the remote.
$repositoryPath = "my-repository"
# The default branch parameter is optional and defaults to "main".
$defaultBranch = "main"
# Clone the martincostello/rebaser repository.
git clone https://github.com/martincostello/rebaser
cd ./rebaser
# Run martincostello/rebaser interactively via the helper script.
./rebase.ps1 $repositoryPath $defaultBranch
# Rebaser will open Visual Studio Code for each file that needs a merge
# conflict to be resolved. Once you have resolved the conflicts, save the
# file and close Visual Studio Code. Rebaser will then continue the rebase.
# Assuming you are happy with the results of the rebase,
# you can then force push the changes to your remote to finish.
# If you don't like the results, then you can reset the branch.
The update-dotnet-sdks workflow runs the
update-dotnet-sdk workflow for all of the repositories
accessible to the configured GitHub Personal Access Token (PAT) that contain
a global.json
file in the repository's root directory.
The behaviour of the update-dotnet-sdk
workflow for a given repository
can be configured through a .github/update-dotnet-sdk.json
file in the
repository to which updates are being performed.
The schema for the configuration file can be found here.
The update-dotnet-sdks-for-nightly
workflow runs the update-dotnet-sdks workflow daily for the dotnet-nightly
branch.
The workflows above are based on a number of conventions to make the same approach easy to apply to multiple repositories. For more information about these conventions and how to apply the ideas in this repository to your own GitHub repositories, see the onboarding documentation.
Any feedback or issues can be added to the issues for this project in GitHub.
The repository is hosted in GitHub: https://github.com/martincostello/github-automation.git
This project is licensed under the Apache 2.0 license.