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.
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
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.