Issue Labeled workflow (bigcalendar/react-big-calendar)
The Issue Labeled workflow from bigcalendar/react-big-calendar, explained and optimized by Latchkey.
CI health: B - good
Point runs-on at Latchkey and get job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Issue Labeled workflow from the bigcalendar/react-big-calendar 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
name: Issue Labeled
on:
issues:
types: [labeled]
permissions:
issues: write
jobs:
reply-labeled:
runs-on: ubuntu-latest
steps:
- name: missing demo
if: github.event.label.name == 'missing demo'
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Hello @${{ github.event.issue.user.login }}. Please provide an online reproduction by [codesandbox](https://codesandbox.io/) or a minimal GitHub repository. You can fork our [Issue Template](https://codesandbox.io/s/react-big-calendar-example-v9wdyd) in codesandbox to get start. Issues labeled by `missing demo` will be closed if no activities in 3 days.
- name: remove missing demo label
if: github.event.label.name == 'missing demo'
uses: actions/github-script@v9
with:
script: |
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'missing demo',
})
} catch (error) {
if (error.status !== 404) throw error
}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Issue Labeled on: issues: types: [labeled] permissions: issues: write jobs: reply-labeled: timeout-minutes: 30 runs-on: latchkey-small steps: - name: missing demo if: github.event.label.name == 'missing demo' uses: peter-evans/create-or-update-comment@v5 with: token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ github.event.issue.number }} body: | Hello @${{ github.event.issue.user.login }}. Please provide an online reproduction by [codesandbox](https://codesandbox.io/) or a minimal GitHub repository. You can fork our [Issue Template](https://codesandbox.io/s/react-big-calendar-example-v9wdyd) in codesandbox to get start. Issues labeled by `missing demo` will be closed if no activities in 3 days. - name: remove missing demo label if: github.event.label.name == 'missing demo' uses: actions/github-script@v9 with: script: | try { await github.rest.issues.removeLabel({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, name: 'missing demo', }) } catch (error) { if (error.status !== 404) throw error }
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.
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.