Skip to content
Latchkey

Feedback Label Automation workflow (mietzen/porkbun-ddns)

The Feedback Label Automation workflow from mietzen/porkbun-ddns, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: mietzen/porkbun-ddns.github/workflows/feedback-label.ymlLicense MITView source

What it does

This is the Feedback Label Automation workflow from the mietzen/porkbun-ddns repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

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

The workflow

workflow (.yml)
name: Feedback Label Automation

on:
  issue_comment:
    types: [created]

permissions:
  issues: write

jobs:
  manage-feedback-label:
    runs-on: ubuntu-latest
    if: ${{ !github.event.issue.pull_request }}
    steps:
      - name: Checkout
        uses: actions/checkout@v7

      - name: Determine commenter role
        id: determine-role
        run: |
          AUTHOR="${{ github.event.comment.author_association }}"
          if [[ "$AUTHOR" == "OWNER" || "$AUTHOR" == "MEMBER" || "$AUTHOR" == "COLLABORATOR" ]]; then
            echo "IS_MAINTAINER=true" >> $GITHUB_ENV
          else
            echo "IS_MAINTAINER=false" >> $GITHUB_ENV
          fi

          ISSUE_STATE="${{ github.event.issue.state }}"
          HAS_ENHANCEMENT_LABEL=false
          for label in "${{ toJson(github.event.issue.labels) }}" ; do
            if [[ "$label" == *"enhancement"* ]]; then
              HAS_ENHANCEMENT_LABEL=true
              break
            fi
          done

          if [[ "$ISSUE_STATE" == "open" && "$HAS_ENHANCEMENT_LABEL" == "false" ]]; then
            echo "IS_ELIGIBLE=true" >> $GITHUB_ENV
          else
            echo "IS_ELIGIBLE=false" >> $GITHUB_ENV
          fi

      - name: Add 'feedback required' label
        if: env.IS_MAINTAINER == 'true' && env.IS_ELIGIBLE == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh issue edit ${{ github.event.issue.number }} --add-label "Feedback needed"

      - name: Remove 'feedback required' label
        if: env.IS_MAINTAINER == 'false' && env.IS_ELIGIBLE == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh issue edit ${{ github.event.issue.number }} --remove-label "Feedback needed"

The same workflow, on Latchkey

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

name: Feedback Label Automation
 
on:
  issue_comment:
    types: [created]
 
permissions:
  issues: write
 
jobs:
  manage-feedback-label:
    timeout-minutes: 30
    runs-on: latchkey-small
    if: ${{ !github.event.issue.pull_request }}
    steps:
      - name: Checkout
        uses: actions/checkout@v7
 
      - name: Determine commenter role
        id: determine-role
        run: |
          AUTHOR="${{ github.event.comment.author_association }}"
          if [[ "$AUTHOR" == "OWNER" || "$AUTHOR" == "MEMBER" || "$AUTHOR" == "COLLABORATOR" ]]; then
            echo "IS_MAINTAINER=true" >> $GITHUB_ENV
          else
            echo "IS_MAINTAINER=false" >> $GITHUB_ENV
          fi
 
          ISSUE_STATE="${{ github.event.issue.state }}"
          HAS_ENHANCEMENT_LABEL=false
          for label in "${{ toJson(github.event.issue.labels) }}" ; do
            if [[ "$label" == *"enhancement"* ]]; then
              HAS_ENHANCEMENT_LABEL=true
              break
            fi
          done
 
          if [[ "$ISSUE_STATE" == "open" && "$HAS_ENHANCEMENT_LABEL" == "false" ]]; then
            echo "IS_ELIGIBLE=true" >> $GITHUB_ENV
          else
            echo "IS_ELIGIBLE=false" >> $GITHUB_ENV
          fi
 
      - name: Add 'feedback required' label
        if: env.IS_MAINTAINER == 'true' && env.IS_ELIGIBLE == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh issue edit ${{ github.event.issue.number }} --add-label "Feedback needed"
 
      - name: Remove 'feedback required' label
        if: env.IS_MAINTAINER == 'false' && env.IS_ELIGIBLE == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh issue edit ${{ github.event.issue.number }} --remove-label "Feedback needed"
 

What changed

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

Actions used in this workflow