Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Labels

# Reusable: makes repositories' labels match the toolkit's labels.yml and
# your own label files. A dry run unless apply is true; never deletes a label
# unless prune is true.

on:
workflow_call:
inputs:
files:
description: "Your label files, space-separated paths in your repository, read after the toolkit's"
type: string
default: ""
base:
description: "Start from the toolkit's labels.yml"
type: boolean
default: true
groups:
description: "Comma-separated groups to use, from every file (empty: all)"
type: string
default: "type,status,priority"
repos:
description: "Space-separated OWNER/NAME list (default: the calling repository)"
type: string
default: ""
apply:
description: "Make the changes; otherwise only list them"
type: boolean
default: false
prune:
description: "Also delete labels that are not in the files"
type: boolean
default: false
toolkit-ref:
description: "The toolkit version to run the script from"
type: string
default: v0
secrets:
token:
description: "A token that can edit labels in every repository listed (default: the workflow's own token)"
required: false

permissions:
contents: read
issues: write

jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v4
with:
repository: Horrible-Dev/toolkit
ref: ${{ inputs.toolkit-ref }}
path: .toolkit

- name: Install
run: python3 -m pip install --quiet pyyaml

- name: Sync labels
env:
GH_TOKEN: ${{ secrets.token || github.token }}
FILES: ${{ inputs.files }}
BASE: ${{ inputs.base }}
LABEL_GROUPS: ${{ inputs.groups }}
REPOS: ${{ inputs.repos || github.repository }}
APPLY: ${{ inputs.apply }}
PRUNE: ${{ inputs.prune }}
run: |
set -- --groups "$LABEL_GROUPS"
[ "$BASE" = true ] && set -- "$@" --file .toolkit/labels/labels.yml
for file in $FILES; do set -- "$@" --file "$file"; done
for repo in $REPOS; do set -- "$@" --repo "$repo"; done
[ "$APPLY" = true ] && set -- "$@" --apply
[ "$PRUNE" = true ] && set -- "$@" --prune
python3 .toolkit/labels/sync_labels.py "$@" | tee -a "$GITHUB_STEP_SUMMARY"
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,49 @@ Shared GitHub workflows, actions and scripts for Horrible Dev projects. Each pro

Pin a major version tag, like `@v0`. Breaking changes only come with a new major version.

## Labels

[labels/labels.yml](labels/labels.yml) is one shared set of labels, in groups:

- `type`: bug, enhancement, documentation and the other GitHub defaults.
- `status`: the status words, the same everywhere. Fixed, Solved, Implemented, In progress, Planned, Needs info and Won't do, plus `needs-retest`.
- `priority`: high, medium and low.
- `platform` and `area`: examples. Pick the ones you need, or write your own.

[labels/sync_labels.py](labels/sync_labels.py) makes a repository's labels match. It only lists changes unless you pass `--apply`. It never deletes a label unless you pass `--prune`.

```sh
python3 labels/sync_labels.py --repo OWNER/NAME --groups type,status,priority
python3 labels/sync_labels.py --repo OWNER/NAME --file my-labels.yml --apply
```

Your own file uses the same format and can add groups. It's read after the base file, so it wins for the same name. To rename a label and keep it on its issues, list the old name under `renamed_from`.

To run it from Actions, call the reusable workflow:

```yaml
# .github/workflows/labels.yml
name: Labels
on:
workflow_dispatch:
inputs:
apply:
type: boolean
default: false
permissions:
contents: read
issues: write
jobs:
labels:
uses: Horrible-Dev/toolkit/.github/workflows/labels.yml@v0
with:
files: .github/labels.yml
groups: type,status,priority,platform,project
apply: ${{ inputs.apply || false }}
```

To sync other repositories, list them in `repos` and pass a token that can edit their labels as the `token` secret.

## Credits

Parts of the toolkit are adapted from ChupathingyCE's release and housekeeping tools.
Expand Down
112 changes: 112 additions & 0 deletions labels/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Shared labels for Horrible Dev projects. Each top-level key is a group;
# sync_labels.py --groups picks which ones a repository gets. A project can
# add its own file after this one (later files win for the same name).
#
# Each label: name, color (six hex digits, no #), description (optional),
# renamed_from (optional: old names to rename, so issues keep the label).

type:
- name: bug
color: d73a4a
description: Something isn't working
- name: enhancement
color: a2eeef
description: New feature or request
- name: documentation
color: 0075ca
description: Improvements or additions to documentation
- name: question
color: d876e3
description: Further information is requested
- name: duplicate
color: cfd3d7
description: This issue or pull request already exists
- name: invalid
color: e4e669
description: This doesn't seem right
- name: good first issue
color: 7057ff
description: Good for newcomers
- name: help wanted
color: 008672
description: Extra attention is needed
- name: accessibility
color: f143ab
description: Barrier affecting people with disabilities

# The status words, the same on GitHub, forum tags and replies.
status:
- name: "status: fixed"
color: 0e8a16
description: The bug is fixed
- name: "status: solved"
color: 0e8a16
description: The question is answered
- name: "status: implemented"
color: 0e8a16
description: The idea has shipped
- name: "status: in progress"
color: 1d76db
description: Being worked on for the next release
- name: "status: planned"
color: 5319e7
description: Planned for a later release
- name: "status: needs info"
color: fbca04
description: Waiting on details from the reporter
- name: "status: won't do"
color: ffffff
description: This will not be worked on
- name: needs-retest
color: c5def5
description: Reported on an older build; needs a retest on the current release

priority:
- name: "priority: high"
color: b60205
description: "Fix soon: crashes, broken features, many people affected"
- name: "priority: medium"
color: fbca04
description: Should be fixed in the next release or two
- name: "priority: low"
color: c2e0c6
description: Nice to have, rare, or cosmetic

# Examples: pick the platforms a project ships on.
platform:
- name: windows
color: c5def5
- name: macos
color: "999999"
description: macOS builds
- name: linux
color: c5def5
- name: steam-deck
color: c5def5
- name: android
color: c5def5
- name: xbox
color: c5def5
- name: xbox-360
color: c5def5
- name: wii-u
color: c5def5
- name: switch
color: c5def5

# Examples: areas most projects have. Add your own in a project file.
area:
- name: audio
color: c5def5
- name: crash
color: c5def5
- name: input
color: c5def5
- name: network
color: c5def5
- name: performance
color: c5def5
- name: rendering
color: c5def5
- name: ui
color: c5def5
Loading
Loading