Check Maintainer Edits Enabled workflow (taylorwilsdon/google_workspace_mcp)
The Check Maintainer Edits Enabled workflow from taylorwilsdon/google_workspace_mcp, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Check Maintainer Edits Enabled workflow from the taylorwilsdon/google_workspace_mcp 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: Check Maintainer Edits Enabled
on:
pull_request:
types: [opened, synchronize, reopened, edited]
permissions:
pull-requests: read
issues: write
jobs:
check-maintainer-edits:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.fork == true || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Check if maintainer edits are enabled
uses: actions/github-script@v7
with:
script: |
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
if (!pr.maintainer_can_modify) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'β οΈ **Maintainer edits not enabled**\n\n' +
'This repository requires that you enable "Allow edits from maintainers" for your pull request. This allows maintainers to make small fixes and improvements directly to your branch, which speeds up the review process.\n\n' +
'**To enable this setting:**\n' +
'1. Go to your pull request page\n' +
'2. In the right sidebar, look for "Allow edits from maintainers"\n' +
'3. Check the checkbox to enable it\n\n' +
'Once you\'ve enabled this setting, this check will automatically pass. Thank you! π'
});
core.setFailed('Maintainer edits must be enabled for this pull request');
} else {
console.log('β
Maintainer edits are enabled');
}
check-maintainer-edits-internal:
runs-on: ubuntu-latest
if: github.event.pull_request.head.repo.fork == false && github.event.pull_request.head.repo.full_name == github.repository
steps:
- name: Skip check for internal PRs
run: |
echo "β
Skipping maintainer edits check for internal pull request"
echo "This check only applies to external contributors and forks"The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Check Maintainer Edits Enabled on: pull_request: types: [opened, synchronize, reopened, edited] permissions: pull-requests: read issues: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: check-maintainer-edits: timeout-minutes: 30 runs-on: latchkey-small if: github.event.pull_request.head.repo.fork == true || github.event.pull_request.head.repo.full_name != github.repository steps: - name: Check if maintainer edits are enabled uses: actions/github-script@v7 with: script: | const { data: pr } = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.issue.number }); if (!pr.maintainer_can_modify) { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: 'β οΈ **Maintainer edits not enabled**\n\n' + 'This repository requires that you enable "Allow edits from maintainers" for your pull request. This allows maintainers to make small fixes and improvements directly to your branch, which speeds up the review process.\n\n' + '**To enable this setting:**\n' + '1. Go to your pull request page\n' + '2. In the right sidebar, look for "Allow edits from maintainers"\n' + '3. Check the checkbox to enable it\n\n' + 'Once you\'ve enabled this setting, this check will automatically pass. Thank you! π' }); core.setFailed('Maintainer edits must be enabled for this pull request'); } else { console.log('β Maintainer edits are enabled'); } check-maintainer-edits-internal: timeout-minutes: 30 runs-on: latchkey-small if: github.event.pull_request.head.repo.fork == false && github.event.pull_request.head.repo.full_name == github.repository steps: - name: Skip check for internal PRs run: | echo "β Skipping maintainer edits check for internal pull request" echo "This check only applies to external contributors and forks"
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. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.