Label issues based on matched strings.
Required A JSON-stringified list of objects indicating the text
to search for and the issue label
to apply when a match is found. For example, search_objects: '[{ "text": "4.1.1", "label": "WCAG 4.1.1" }]'
.
Optional If true
, searching will stop when a match is found (so one label will be applied at most). If false
, every search object will be checked (so many labels may be applied). Default: false
.
Optional The owner of the repo containing the issue to autolabel. This is a GitHub username if the repo is user-owned, or a GitHub org name if the repo is org-owned. For example, owner: smockle
. By default, owner
is the owner of the repo containing the workflow running smockle/action-autolabel
.
Optional The name of the repo containing the issue to autolabel. For example, repo: action-autolabel
. By default, repo
is the repo containing the workflow running smockle/action-autolabel
.
Required A space-delimited list of issue numbers indicating the issues to autolabel. For example, issue_numbers: "1 2 3"
. When issues.opened
triggers the workflow, issues_numbers
defaults to the newly-opened issue’s number, so issue_numbers
is optional. In all other cases, issue_numbers
is required.
Required A GitHub token with the public_repo
(for use in public repos) or repo
(for use in private repos) scope.
name: Autolabel
on:
# Run manually
workflow_dispatch:
# Run daily
schedule:
- cron: "0 0 * * *" # https://crontab.guru/daily
# Run when issues are created
issues:
types: [opened]
jobs:
wcag_labeler:
name: WCAG Labeler
runs-on: ubuntu-latest
steps:
- uses: smockle/action-autolabel@dist
with:
search_objects: '[{ text: "4.1.1", label: "WCAG 4.1.1" }, { text: "4.1.2", label: "4.1.2" }]'
limit_matches: false
owner: smockle
repo: action-autolabel
issue_numbers: "1"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
smockle/action-autolabel
includes unit and integration tests. After cloning the smockle/action-autolabel
repo locally, run npm install
in the project folder to install dependencies. Run npm run test:unit
to execute unit tests, or run npm run test:integration
to execute integration tests. A GitHub token with the public_repo
(for use in public repos) or repo
(for use in private repos) scope is required to be present in the environment as GH_TOKEN
to run integration tests.
After every commit to main
, the “Publish” workflow uses smockle/action-release-branch to build and deploy to the dist
branch (which, as noted in Example usage above, is the branch users should specify in their workflows: uses: smockle/action-autolabel@dist
).