Skip to content

Releases: dotnet/issue-labeler

v2.0.0 - Migrate from GitHub Reusable Workflows to GitHub Actions

30 Apr 20:52
Compare
Choose a tag to compare

Referencing v2.0.0

To reference dotnet/issue-labeler v2.0.0 actions, workflows should pin to the SHA associated with the release as follows:

  • uses: dotnet/issue-labeler/download@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
  • uses: dotnet/issue-labeler/train@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
  • uses: dotnet/issue-labeler/test@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
  • uses: dotnet/issue-labeler/promote@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
  • uses: dotnet/issue-labeler/restore@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0
  • uses: dotnet/issue-labeler/predict@46125e85e6a568dc712f358c39f35317366f5eed # v2.0.0

What's New

Since launching Release v1.0.0 - 2025-03-06 - Initial version of GitHub workflow-based Issue Labeler, we've accumulated feedback and explored how to take this even further by migrating from Reusable Workflows to GitHub Actions. This will offers notable usability, stability, and maintainability benefits both for the implementation of the issue-labeler and more so for repositories that consume it.

Some reference documents on the types of reusability:

Notable Benefits

  • With the reusable workflows approach, every consuming repository needed to run a workflow to build the predictor-app and store it in the GitHub Action Cache, and use workflows to try to prevent the app from being evicted from cache.
    • If the predictor-app gets evicted from cache, all prediction jobs start failing
    • With a Docker-based GitHub Action, a container image with the predictor app is published to the GitHub Container Registry, providing a faster and more reliable way to invoke the predictor
  • Fewer and simpler workflows to manage in consuming repositories
    • With the reusable workflows, a lot of YAML-based workflow logic was replicatated into each consuming repository for managing the full lifecycle of the issue-labler's implementation details
    • The GitHub Actions introduced here consolidate much more of the workflow logic into the issue-labeler's action.yml files, and the workflows in each consuming repository are simpler to set up and maintain
  • Substantially improved output on the workflow jobs
    • While the reusable workflows could have gone further with their output, adoption of the GitHub Actions approach enables the usage of the GitHub.Actions.Core package to integrate rich summary and log output into each of the actions
    • All actions now produce rich summaries visible in the GitHub UI, displayed detailed information about data downloading, model training, model testing, model promotion, and testing
    • For example, to understand the model testing results previously, the full console log from the Tester application needed to be inspected and interpreted; teams onboarding to the issue-labeler shared feedback this was unintuitive. With the GitHub Actions implemented here, detailed job summaries are emitted in markdown and visibile on the Actions page in GitHub. The reports provide alerts that indicate whether training was deemed favorable, and links are provided for next steps.
    • Error handling is similarly improved throughout, with detailed console and summary output for all errors that occur, improving troubleshooting for consumers
  • Maintainability of Downloader, Trainer, Tester, and Predictor applications
    • The implementations have been revised to improve input/argument processing, and control flow

Migration for Consumers

Once a release with the GitHub Actions based implementation is merged, consumers will migrate by:

  1. Delete the labeler-build-predictor.yml workflow
  2. Update the labeler-cache-retention.yml workflow
  3. Update the labeler-predict-issues.yml workflow
  4. Update the labeler-predict-pulls.yml workflow
  5. Update the labeler-promote.yml workflow
  6. Update the labeler-train.yml workflow
  7. Delete all existing issue-labeler Action Cache entries, including the issue-labeler/predictor-app and all models
  8. Run the updated labeler-train.yml workflow to re-train the models, as the cache key naming conventions were updated
  9. Run the updated labeler-promote.yml workflow to promote the newly trained workflows into use

Issues Resolved

The following issues are resolved with this PR:

Fixes #87
Fixes #93
Fixes #95
Fixes #97
Fixes #98
Fixes #99
Fixes #100
Fixes #103

Workflow Onboarding and Execution

Issue labeler onboarding (jeffhandley/labeler-demo#1) illustrates the revised onboarding experience for adding the worfklows into a repository.

Here are example workflow runs showing the training, promotion, prediction, and cache retention job results:

v1.0.1 - 2025-03-07 - Solidifying release process

07 Mar 11:27
f0c0986
Compare
Choose a tag to compare
Staging the v1.0.1 release (step 2) (#90)

v1.0.0 - 2025-03-06 - Initial version of GitHub workflow-based Issue Labeler

07 Mar 03:56
3fe21fb
Compare
Choose a tag to compare

Repositories adopting the v1.0.0 workflows must pin to the 3fe21fbd027653d2263d259333b154d33c157572 SHA using the following reusable workflow references. Note that pinning to a SHA requires using the full SHA.

/.github/workflows/labeler-train.yml

name: "Labeler: Train Models"

on:
  # Dispatched via the Actions UI, stages new models for promotion consideration
  # Each step of the workflow can be run independently: Download, Train, and Test
  workflow_dispatch:
    inputs:
      download_issues:
        description: "Issues: Download Data"
        type: boolean
        default: true
      train_issues:
        description: "Issues: Train Model"
        type: boolean
        default: true
      test_issues:
        description: "Issues: Test Model"
        type: boolean
        default: true
      download_pulls:
        description: "Pulls: Download Data"
        type: boolean
        default: true
      train_pulls:
        description: "Pulls: Train Model"
        type: boolean
        default: true
      test_pulls:
        description: "Pulls: Test Model"
        type: boolean
        default: true

      data_limit:
        description: "Max number of items to include in the model"
        type: number

      github_token:
        description: "The GitHub token (defaults to action token)"
        type: string
      repository:
        description: "The org/repo to download data from (defaults to current repository)"
        type: string
      cache_key_suffix:
        description: "The cache key suffix to use for staging data/models (use 'LIVE' to bypass staging)"
        type: string
        required: true
        default: "staging"

jobs:
  labeler-train:
    permissions:
      issues: read
      pull-requests: read
      actions: write
    uses: dotnet/issue-labeler/.github/workflows/train.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      download_issues: ${{ inputs.download_issues }}
      train_issues: ${{ inputs.train_issues }}
      test_issues: ${{ inputs.test_issues }}
      download_pulls: ${{ inputs.download_pulls }}
      train_pulls: ${{ inputs.train_pulls }}
      test_pulls: ${{ inputs.test_pulls }}
      data_limit: ${{ inputs.data_limit && fromJSON(inputs.data_limit) || 0 }}
      github_token: ${{ inputs.github_token }}
      repository: ${{ inputs.repository }}
      cache_key_suffix: ${{ inputs.cache_key_suffix }}
      label_prefix: "area-"
      threshold: 0.40

/.github/workflows/labeler-promote.yml

name: "Labeler: Promote Models"

on:
  # Dispatched via the Actions UI, promotes the staged models from
  # a staging slot into the prediction environment
  workflow_dispatch:
    inputs:
      promote_issues:
        description: "Issues: Promote Model"
        type: boolean
        required: true
      promote_pulls:
        description: "Pulls: Promote Model"
        type: boolean
        required: true
      model_cache_key:
        description: "The cache key suffix to promote into the 'LIVE' cache"
        type: string
        required: true
        default: "staging"
      backup_cache_key:
        description: "The cache key suffix to use for backing up the currently promoted model"
        type: string
        default: "backup"

permissions:
  actions: write

jobs:
  labeler-promote-issues:
    if: ${{ inputs.promote_issues }}
    uses: dotnet/issue-labeler/.github/workflows/promote-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      model_cache_key: ${{ inputs.model_cache_key }}
      backup_cache_key: ${{ inputs.backup_cache_key }}

  labeler-promote-pulls:
    if: ${{ inputs.promote_pulls }}
    uses: dotnet/issue-labeler/.github/workflows/promote-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      model_cache_key: ${{ inputs.model_cache_key }}
      backup_cache_key: ${{ inputs.backup_cache_key }}

/.github/workflows/labeler-predict-issues.yml

name: "Labeler: Predict Issue Labels"

on:
  # Only automatically predict area labels when issues are originally opened
  issues:
    types: opened

  # Allow dispatching the workflow via the Actions UI, specifying ranges of numbers
  workflow_dispatch:
    inputs:
      issue_numbers:
        description: "Issue Numbers (comma-separated list of ranges)"
        type: string
      model_cache_key:
        description: "The cache key suffix to use for loading the model"
        type: string
        required: true
        default: "LIVE"

jobs:
  predict-issues:
    # Do not run the workflow on forks outside the 'dotnet' org
    if: ${{ github.repository_owner == 'dotnet' && (inputs.issue_numbers || github.event.issue.number) }}
    permissions:
      issues: write
    uses: dotnet/issue-labeler/.github/workflows/predict-issues.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      model_cache_key: ${{ inputs.model_cache_key }}
      issue_numbers: ${{ inputs.issue_numbers || github.event.issue.number }}
      label_prefix: "area-"
      threshold: 0.40
      default_label: "needs-area-label"

/.github/workflows/labeler-predict-pulls.yml

name: "Labeler: Predict Pull Labels"

on:
  # Per to the following documentation:
  # https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull_request_target
  #
  # The `pull_request_target` event runs in the context of the base of the pull request, rather
  # than in the context of the merge commit, as the `pull_request` event does. This prevents
  # execution of unsafe code from the head of the pull request that could alter the repository
  # or steal any secrets you use in your workflow. This event allows your workflow to do things
  # like label or comment on pull requests from forks.
  #
  # Only automatically predict area labels when pull requests are first opened
  pull_request_target:
    types: opened

  # Allow dispatching the workflow via the Actions UI, specifying ranges of numbers
  workflow_dispatch:
    inputs:
      pull_numbers:
        description: "Pull Numbers (comma-separated list of ranges)"
        type: string
      model_cache_key:
        description: "The cache key suffix to use for loading the model"
        type: string
        required: true
        default: "LIVE"

jobs:
  predict-pulls:
    # Do not run the workflow on forks outside the 'dotnet' org
    if: ${{ github.repository_owner == 'dotnet' && (inputs.pull_numbers || github.event.number) }}
    permissions:
      pull-requests: write
    uses: dotnet/issue-labeler/.github/workflows/predict-pulls.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      model_cache_key: ${{ inputs.model_cache_key }}
      pull_numbers: ${{ inputs.pull_numbers || github.event.number }}
      label_prefix: "area-"
      threshold: 0.40

labeler-cache-retention.yml

name: "Labeler: Cache Retention"

on:
  schedule:
    - cron: "6 3 * * *" # 3:06 every day (arbitrary time daily)

  workflow_dispatch:

jobs:
  cache-retention:
    # Do not run the workflow on forks outside the 'dotnet' org
    if: ${{ github.repository_owner == 'dotnet' }}
    uses: dotnet/issue-labeler/.github/workflows/cache-retention.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0

/.github/workflows/labeler-build-predictor.yml

name: "Labeler: Build Predictor App"

on:
  # Allow dispatching the workflow via the Actions UI
  workflow_dispatch:
    inputs:
      rebuild:
        description: "Force a rebuild of the app"
        type: boolean

jobs:
  build-predictor:
    permissions:
      actions: write
    uses: dotnet/issue-labeler/.github/workflows/build-predictor.yml@3fe21fbd027653d2263d259333b154d33c157572 # v1.0.0
    with:
      rebuild: ${{ inputs.rebuild }}