Skip to content
Latchkey

Allows for the adding and removing of labels via comment workflow (openedx/codejail)

The Allows for the adding and removing of labels via comment workflow from openedx/codejail, explained and optimized by Latchkey.

B

CI health: B - good

Run this on Latchkey for self-healing, caching, and up to 58% lower cost.

Grade your own workflow free or run it on Latchkey →
Source: openedx/codejail.github/workflows/add-remove-label-on-comment.ymlLicense Apache-2.0View source

What it does

This is the Allows for the adding and removing of labels via comment workflow from the openedx/codejail repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# This workflow runs when a comment is made on the ticket
# If the comment starts with "label: " it tries to apply
# the label indicated in rest of comment.
# If the comment starts with "remove label: ", it tries
# to remove the indicated label.
# Note: Labels are allowed to have spaces and this script does
# not parse spaces (as often a space is legitimate), so the command
# "label: really long lots of words label" will apply the
# label "really long lots of words label"

name: Allows for the adding and removing of labels via comment

on:
  issue_comment:
    types: [created]

jobs:
  add_remove_labels:
    uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

# This workflow runs when a comment is made on the ticket
# If the comment starts with "label: " it tries to apply
# the label indicated in rest of comment.
# If the comment starts with "remove label: ", it tries
# to remove the indicated label.
# Note: Labels are allowed to have spaces and this script does
# not parse spaces (as often a space is legitimate), so the command
# "label: really long lots of words label" will apply the
# label "really long lots of words label"
 
name: Allows for the adding and removing of labels via comment
 
on:
  issue_comment:
    types: [created]
 
jobs:
  add_remove_labels:
    timeout-minutes: 30
    uses: openedx/.github/.github/workflows/add-remove-label-on-comment.yml@master
 
 

What changed

1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.