Skip to content

Commit cb9025f

Browse files
committed
feat: automated releases and auto labelling
- [x] lint pr title adhering to conventional commits (helps with auto labelling) - [x] Update CONTRIBUTING.md - [x] automated releases - [x] how to file a bug report - [x] how to file an enhancement - [x] Update pull_request_template with new standard - [x] setup autolabelling through release-drafter github action config - [x] create auto-labeler workflow - [x] change release-drafter workflow to release - [x] create release, including new tag - [x] create discussion announcement based on release - [x] build container images, tag them and release them - [x] update typo in .github/ISSUE_TEMPLATES/config.yml (GitHuB to GitHub) Signed-off-by: jmeridth <[email protected]>
1 parent 1755607 commit cb9025f

File tree

7 files changed

+170
-60
lines changed

7 files changed

+170
-60
lines changed

.github/ISSUE_TEMPLATE/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ contact_links:
66
about: Ask a question or start a discussion
77
- name: GitHub OSPO GitHub Action Overall Issue
88
url: https://github.com/github/github-ospo/issues/new
9-
about: File issue for multiple GitHub OSPO GitHuB Actions
9+
about: File issue for multiple GitHub OSPO GitHub Actions

.github/pull_request_template.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Pull Request
2-
<!-- PR title should be brief and descriptive for a good changelog entry -->
2+
<!--
3+
PR title needs to be prefixed with a conventional commit type
4+
(build,chore,ci,docs,feat,fix,perf,refactor,revert,style,test)
5+
6+
It should also be brief and descriptive for a good changelog entry
7+
8+
examples: "feat: add new logger" or "fix: remove unused imports"
9+
-->
310

411
## Proposed Changes
512
<!-- Describe what the changes are and link to a GitHub Issue if one exists -->
@@ -14,4 +21,4 @@
1421

1522
### Reviewer
1623

17-
- [ ] Label as either `bug`, `documentation`, `enhancement`, `infrastructure`, or `breaking`
24+
- [ ] Label as either `fix`, `documentation`, `enhancement`, `infrastructure`, or `breaking`

.github/workflows/auto-labeler.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Auto Labeler
3+
4+
on:
5+
# pull_request event is required only for autolabeler
6+
pull_request:
7+
# Only following types are handled by the action, but one can default to all as well
8+
types: [opened, reopened, synchronize]
9+
# pull_request_target event is required for autolabeler to support PRs from forks
10+
pull_request_target:
11+
types: [opened, reopened, synchronize]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
main:
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
name: Auto label pull requests
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: release-drafter/release-drafter@v6
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
config-name: release-drafter.yml

.github/workflows/pr-title.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Reference: https://github.com/amannn/action-semantic-pull-request
2+
---
3+
name: "Lint PR Title"
4+
5+
on:
6+
pull_request_target:
7+
types:
8+
- opened
9+
- edited
10+
- synchronize
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
main:
17+
permissions:
18+
pull-requests: read
19+
statuses: write
20+
name: Validate PR title
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: amannn/action-semantic-pull-request@v5
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
# Configure which types are allowed (newline-delimited).
28+
# From: https://github.com/commitizen/conventional-commit-types/blob/master/index.json
29+
# listing all below
30+
types: |
31+
build
32+
chore
33+
ci
34+
docs
35+
feat
36+
fix
37+
perf
38+
refactor
39+
revert
40+
style
41+
test

.github/workflows/release-drafter.yml

-25
This file was deleted.

.github/workflows/release.yml

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: Release
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
create_release:
15+
outputs:
16+
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
17+
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}
18+
body: ${{ steps.release-drafter.outputs.body }}
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
pull-requests: read
23+
steps:
24+
- uses: release-drafter/release-drafter@v6
25+
id: release-drafter
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
config-name: release-drafter.yml
30+
publish: true
31+
- name: Get the short tag
32+
id: get_tag_name
33+
run: |
34+
short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1)
35+
echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT
36+
create_action_images:
37+
needs: create_release
38+
runs-on: ubuntu-latest
39+
permissions:
40+
packages: write
41+
env:
42+
REGISTRY: ghcr.io
43+
IMAGE_NAME: stale_repos # different than repo name (underscore instead of dash)
44+
steps:
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
with:
48+
driver-opts: |
49+
image=moby/buildkit:v0.13.1
50+
- name: Log in to the Container registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ${{ env.REGISTRY }}
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
- uses: actions/checkout@v4
57+
- name: Push Docker Image
58+
if: ${{ success() }}
59+
uses: docker/build-push-action@v5
60+
with:
61+
context: .
62+
file: ./Dockerfile
63+
push: true
64+
tags: |
65+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
66+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.full-tag }}
67+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.create_release.outputs.short-tag }}
68+
platforms: linux/amd64
69+
provenance: false
70+
sbom: false
71+
create_discussion:
72+
needs: create_release
73+
runs-on: ubuntu-latest
74+
permissions:
75+
discussions: write
76+
steps:
77+
- name: Create an announcement discussion for release
78+
uses: abirismyname/[email protected]
79+
env:
80+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
title: ${{ needs.create_release.outputs.full-tag }}
83+
body: ${{ needs.create_release.outputs.body }}
84+
repository-id: ${{ secrets.RELEASE_DISCUSSION_REPOSITORY_ID }}
85+
category-id: ${{ secrets.RELEASE_DISCUSSION_CATEGORY_ID }}

CONTRIBUTING.md

+6-32
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
5252
<!-- omit in toc -->
5353
### How Do I Submit a Good Bug Report?
5454

55-
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
56-
57-
- Open an [Issue](https://github.com/github/stale-repos/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.)
58-
- Explain the behavior you would expect and the actual behavior.
59-
- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case.
60-
- Provide the information you collected in the previous section.
61-
62-
Once it's filed:
63-
64-
- The project team will label the issue accordingly.
65-
- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced.
66-
- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be implemented by someone.
55+
Please submit a bug report using our [GitHub Issues template](https://github.com/github/stale-repos/issues/new?template=bug_report.yml).
6756

6857
## Suggesting Enhancements
6958

@@ -80,27 +69,12 @@ This section guides you through submitting an enhancement suggestion for stale_r
8069
<!-- omit in toc -->
8170
### How Do I Submit a Good Enhancement Suggestion?
8271

83-
Enhancement suggestions are tracked as [GitHub issues](https://github.com/github/stale-repos/issues).
72+
Please submit an enhancement suggestion using our [GitHub Issues template](https://github.com/github/stale-repos/issues/new?template=feature_request.yml).
73+
74+
### Pull Request Standards
8475

85-
- Use a **clear and descriptive title** for the issue to identify the suggestion.
86-
- Provide a **step-by-step description of the suggested enhancement** in as many details as possible.
87-
- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you.
88-
- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to.
89-
- **Explain why this enhancement would be useful** to most stale_repos users.
76+
We are using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) to standardize our pull request titles. This allows us to automatically generate labels and changelogs and follow semantic versioning. Please follow the commit message format when creating a pull request. What pull request title prefixes are expected are in the [pull_request_template.md](.github/pull_request_template.md) that is shown when creating a pull request.
9077

9178
## Releases
9279

93-
To release a new version, maintainers are to release new versions following semantic versioning and via GitHub Releases.
94-
Once the code is ready to release please do the following
95-
1. Create a [GitHub release](https://github.com/github/stale-repos/releases) based off the current draft and review release notes
96-
2. Ensure that the versioning is correct given the content of the release
97-
3. Check the box to release it to the GitHub Marketplace
98-
4. Publish the release
99-
5. Clone the repository at the release tag locally or in a codespace
100-
6. Authenticate to ghcr.io using [these instructions](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry)
101-
7. `docker build --platform linux/amd64 -t ghcr.io/github/stale_repos:v1 .` where v1 is the current major version number
102-
8. `docker build --platform linux/amd64 -t ghcr.io/github/stale_repos:v1.0.0 .` where v1.0.0 is the full version number
103-
9. `docker push ghcr.io/github/stale_repos:v1` where v1 is the current major version number
104-
10. `docker push ghcr.io/github/stale_repos:v1.0.0` where v1.0.0 is the full version number
105-
11. `docker push ghcr.io/github/stale_repos:latest`
106-
12. Update the `action.yml` and `README.md` instructions to point to the new docker container if its a major version number change
80+
Releases are automated but if you need to manually initiate a release you can do so through the GitHub Actions UI. If you have permissions to do so, you can navigate to the [Actions tab](https://github.com/github/stale-repos/actions/workflows/release.yml) and select the `Run workflow` button. This will allow you to select the branch to release from and the version to release.

0 commit comments

Comments
 (0)