SOLFIND
Web Lens
Portal home

inspector/.github/workflows/dependabot-auto-merge.yml at main · MCPJam/inspector · GitHub

https://github.com/MCPJam/inspector/blob/main/.github/workflows/dependabot-auto-merge.yml • 322 KB fetched
Open original page


inspector/.github/workflows/dependabot-auto-merge.yml at main · MCPJam/inspector · GitHub Skip to content Navigation Menu Sign in Appearance settings * Platform * AI CODE CREATION * GitHub Copilot Write better code with AI * GitHub Copilot app Direct agents from issue to merge * MCP Registry Integrate external tools * DEVELOPER WORKFLOWS * Actions Automate any workflow * Codespaces Instant dev environments * Issues Plan and track work * Code Review Manage code changes * Code Quality Enforce quality at merge * APPLICATION SECURITY * GitHub Advanced Security Find and fix vulnerabilities * Code security Secure your code as you build * Secret protection Stop leaks before they start * EXPLORE * Why GitHub * Documentation * Blog * Changelog * Marketplace View all features * Solutions * BY COMPANY SIZE * Enterprises * Small and medium teams * Startups * Nonprofits * BY USE CASE * App Modernization * DevSecOps * DevOps * CI/CD * View all use cases * BY INDUSTRY * Healthcare * Financial services * Manufacturing * Government * View all industries View all solutions * Resources * EXPLORE BY TOPIC * AI * Software Development * DevOps * Security * View all topics * EXPLORE BY TYPE * Customer stories * Events & webinars * Ebooks & reports * Business insights * GitHub Skills * SUPPORT & SERVICES * Documentation * Customer support * Community forum * Trust center * Partners View all resources * Open Source * COMMUNITY * GitHub Sponsors Fund open source developers * PROGRAMS * Security Lab * Maintainer Community * GitHub Stars * Archive Program * REPOSITORIES * Topics * Trending * Collections * Enterprise * ENTERPRISE SOLUTIONS * Enterprise platform AI-powered developer platform * AVAILABLE ADD-ONS * GitHub Advanced Security Enterprise-grade security features * Copilot for Business Enterprise-grade AI features * Premium Support Enterprise-grade 24/7 support * Pricing Search / Sign in Sign up Appearance settings You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Uh oh! There was an error while loading. Please reload this page . MCPJam / inspector Public * Uh oh! There was an error while loading. Please reload this page . * Notifications You must be signed in to change notification settings * Fork 277 * Star 2.2k * Code * Issues 52 * Pull requests 238 * Discussions * Actions * Projects * Security and quality 1 * Insights Additional navigation options * Code * Issues * Pull requests * Discussions * Actions * Projects * Security and quality * Insights Files Expand file tree main Breadcrumbs * inspector * / .github * / workflows / dependabot-auto-merge.yml Copy path View runs Blame More file actions Blame More file actions Latest commit   History History History 207 lines (191 loc) · 9.74 KB main Breadcrumbs * inspector * / .github * / workflows / dependabot-auto-merge.yml Copy path Top File metadata and controls * Code * Blame 207 lines (191 loc) · 9.74 KB Raw Copy raw file Download raw file Open symbols panel Edit and raw actions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 name: Dependabot Auto-merge # Takes exactly ONE action on every Dependabot PR: # - MERGE -> approve + `gh pr merge --auto --squash`, so it lands only # after the required checks ("Build and Test", "Run Tests") pass. # - HOLD -> leave it open for a human and say, in one line, why. # # Scope is deliberately narrow. Auto-merging dependency PRs ships code into # deployed services and the desktop app, so only two classes qualify: # security updates, and patch/minor bumps of DEVELOPMENT dependencies. Every # major, every runtime version bump, and anything touching the Electron / # native packaging chain is held for a person. on: # `pull_request_target`, NOT `pull_request`. Workflows that Dependabot # triggers via `pull_request` run with a read-only GITHUB_TOKEN regardless # of the `permissions:` block below, so `gh pr merge` would 403 — and that # failure is easy to miss. `pull_request_target` runs in base-branch context # with a writable token. # # `pull_request_target` is dangerous when a job checks out and EXECUTES the # PR's code, because that code would run with those write permissions. This # job never does: there is no `actions/checkout` step anywhere below, and # none may be added. It reads metadata through the API and nothing else. pull_request_target: types: [opened, reopened, synchronize] concurrency: group: dependabot-auto-merge-${{ github.event.pull_request.number }} cancel-in-progress: true permissions: {} jobs: decide: # Gate on the PR author, not `github.actor`, which is spoofable and is the # human rather than the bot on a reopen — same reasoning as # mintlify-triage.yml. if: github.event.pull_request.user.login == 'dependabot[bot]' runs-on: ubuntu-latest permissions: contents: write # enable auto-merge pull-requests: write # approve / comment steps: # Pinned to a full commit SHA, not a moving tag: this job holds # `contents: write` and can approve PRs, so a compromised tag would # inherit both. Update the pin deliberately. - name: Fetch Dependabot metadata id: meta uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 with: # `ghsa-id` is populated ONLY when `alert-lookup` is on, and the # lookup needs a PAT or App token — GITHUB_TOKEN cannot read # Dependabot alerts. So this is wired to an optional secret: without # it the workflow still runs and security PRs simply fall through to # the runtime-update hold (a human reads them, nothing is lost); add # DEPENDABOT_ALERTS_TOKEN and security auto-merge lights up with no # further edit. Without this wiring the security branch below would # be dead code that silently never fires. alert-lookup: ${{ secrets.DEPENDABOT_ALERTS_TOKEN != '' }} github-token: ${{ secrets.DEPENDABOT_ALERTS_TOKEN || secrets.GITHUB_TOKEN }} # Metadata reaches the shell through `env:`, never through `${{ }}` # interpolated directly into the script, so a crafted dependency name # cannot break out into the runner shell. - name: Decide the outcome id: decide env: NAMES: ${{ steps.meta.outputs.dependency-names }} UPDATE_TYPE: ${{ steps.meta.outputs.update-type }} DEP_TYPE: ${{ steps.meta.outputs.dependency-type }} GHSA: ${{ steps.meta.outputs.ghsa-id }} ALERT_LOOKUP: ${{ secrets.DEPENDABOT_ALERTS_TOKEN != '' }} run: | set -euo pipefail # The desktop packaging chain. `electron-forge package` is NOT # exercised by any required check — desktop-package-smoke.yml is # path-filtered and advisory — so a green PR proves the app still # builds, never that it still packages. These stay manual until # that smoke job is a required check. hold_desktop=false IFS=',' read -ra pkgs <<<"$NAMES" for raw in "${pkgs[@]}"; do pkg="$(echo "$raw" | tr -d '[:space:]')" case "$pkg" in electron | sharp | @electron/* | @electron-forge/*) hold_desktop=true ;; esac done if [ "$hold_desktop" = true ]; then action=hold reason="touches the Electron/native packaging chain, which no required check exercises" elif [ "$UPDATE_TYPE" = "version-update:semver-major" ]; then action=hold reason="major version update" elif [ -n "$GHSA" ]; then action=merge reason="security update ($GHSA)" elif [ "$DEP_TYPE" = "direct:development" ] && \ { [ "$UPDATE_TYPE" = "version-update:semver-patch" ] || \ [ "$UPDATE_TYPE" = "version-update:semver-minor" ]; }; then action=merge reason="dev-dependency ${UPDATE_TYPE#version-update:semver-} update" else action=hold reason="runtime dependency version update" if [ "$ALERT_LOOKUP" != "true" ]; then # Be explicit rather than letting a security PR look like a # routine bump: without the token we cannot tell them apart. reason="$reason (security detection off — no DEPENDABOT_ALERTS_TOKEN)" fi fi echo "action=$action" >>"$GITHUB_OUTPUT" echo "reason=$reason" >>"$GITHUB_OUTPUT" echo "Decision: $action — $reason (names=$NAMES type=$DEP_TYPE update=$UPDATE_TYPE)" # The approval is the second half of the MERGE decision, not a general # bypass: the "Standard BC" ruleset on main requires 1 approving review, # so without it an auto-merge queue never drains. It is posted by # github-actions[bot], only in this workflow, only for the narrow classes # decided above, and never by the PR author. - name: Approve and queue for auto-merge if: steps.decide.outputs.action == 'merge' env: GH_TOKEN: ${{ github.token }} PR: ${{ github.event.pull_request.number }} REPO: ${{ github.repository }} REASON: ${{ steps.decide.outputs.reason }} run: | set -euo pipefail gh api -X POST "repos/$REPO/pulls/$PR/reviews" \ -f event=APPROVE \ -f body="Auto-approved: $REASON. Queued for auto-merge; it lands only once the required checks pass." >/dev/null gh pr merge "$PR" --repo "$REPO" --auto --squash - name: Hold for human review if: steps.decide.outputs.action == 'hold' env: GH_TOKEN: ${{ github.token }} PR: ${{ github.event.pull_request.number }} REPO: ${{ github.repository }} REASON: ${{ steps.decide.outputs.reason }} EVENT: ${{ github.event.action }} run: | set -euo pipefail # Dependabot rewrites an existing PR in place when a newer version # lands, so a PR queued as a patch on `opened` can come back as a # major on `synchronize`. Without this, the earlier queue survives # the reclassification and merges the thing we just decided to hold. if [ "$(gh api "repos/$REPO/pulls/$PR" --jq '.auto_merge != null')" = "true" ]; then gh pr merge "$PR" --repo "$REPO" --disable-auto echo "Disabled a previously queued auto-merge after reclassification." fi # Comment only on the first look: `synchronize` fires on every # Dependabot rebase and re-commenting would bury the PR in noise. if [ "$EVENT" != "synchronize" ]; then gh pr comment "$PR" --repo "$REPO" \ --body "Held for human review: $REASON. Auto-merge covers security updates and patch/minor dev-dependency bumps only." fi # A run that reaches no outcome must be loud. mintlify-triage.yml learned # this the hard way: a step that soft-skips exits 0 and reports a green # check having done nothing, which is strictly worse than a red X because # nobody can tell it apart from a real decision. - name: Enforce an outcome # Not success(): a soft-skip exits 0. Not always(): `cancel-in-progress` # means a superseded run has legitimately reached no outcome. if: ${{ !cancelled() }} env: GH_TOKEN: ${{ github.token }} PR: ${{ github.event.pull_request.number }} REPO: ${{ github.repository }} ACTION: ${{ steps.decide.outputs.action }} run: | set -euo pipefail pr=$(gh api "repos/$REPO/pulls/$PR") queued=$(jq -r '.auto_merge != null' <<<"$pr") merged=$(jq -r '.merged' <<<"$pr") case "$ACTION" in merge) if [ "$queued" = "true" ] || [ "$merged" = "true" ]; then echo "Outcome: MERGE — auto-merge queued (or already landed)." else echo "::error title=Auto-merge never queued::PR #$PR was classified MERGE but has no auto-merge enabled. Check the approve/queue step — a silent 403 there is the likely cause, which would mean this workflow is running with a read-only token." exit 1 fi ;; hold) if [ "$queued" = "true" ]; then echo "::error title=Held PR still queued::PR #$PR was classified HOLD but auto-merge is still enabled, so it will merge without review. The disable step above did not take effect." exit 1 fi echo "Outcome: HOLD — left for human review." ;; *) echo "::error title=No decision reached::The classify step produced no action for PR #$PR, so neither MERGE nor HOLD ran." exit 1 ;; esac Footer (c) 2026 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Community * Docs * Contact * Manage cookies * Do not share my personal information You can’t perform that action at this time.

Links found on this page

  1. Skip to content [direct]
  2. Sign in [direct]
  3. GitHub Copilot Write better code with AI [direct]
  4. GitHub Copilot app Direct agents from issue to merge [direct]
  5. MCP Registry Integrate external tools [direct]
  6. Actions Automate any workflow [direct]
  7. Codespaces Instant dev environments [direct]
  8. Issues Plan and track work [direct]
  9. Code Review Manage code changes [direct]
  10. Code Quality Enforce quality at merge [direct]
  11. GitHub Advanced Security Find and fix vulnerabilities [direct]
  12. Code security Secure your code as you build [direct]
  13. Secret protection Stop leaks before they start [direct]
  14. Why GitHub [direct]
  15. Documentation [direct]
  16. Blog [direct]
  17. Changelog [direct]
  18. Marketplace [direct]
  19. View all features [direct]
  20. Enterprises [direct]
  21. Small and medium teams [direct]
  22. Startups [direct]
  23. Nonprofits [direct]
  24. App Modernization [direct]
  25. DevSecOps [direct]
  26. DevOps [direct]
  27. CI/CD [direct]
  28. View all use cases [direct]
  29. Healthcare [direct]
  30. Financial services [direct]
  31. Manufacturing [direct]
  32. Government [direct]
  33. View all industries [direct]
  34. View all solutions [direct]
  35. AI [direct]
  36. Software Development [direct]
  37. DevOps [direct]
  38. Security [direct]
  39. View all topics [direct]
  40. Customer stories [direct]
  41. Events & webinars [direct]
  42. Ebooks & reports [direct]
  43. Business insights [direct]
  44. GitHub Skills [direct]
  45. Customer support [direct]
  46. Community forum [direct]
  47. Trust center [direct]
  48. Partners [direct]
  49. View all resources [direct]
  50. GitHub Sponsors Fund open source developers [direct]
  51. Security Lab [direct]
  52. Maintainer Community [direct]
  53. GitHub Stars [direct]
  54. Archive Program [direct]
  55. Topics [direct]
  56. Trending [direct]
  57. Collections [direct]
  58. Copilot for Business Enterprise-grade AI features [direct]
  59. Premium Support Enterprise-grade 24/7 support [direct]
  60. Pricing [direct]
  61. Sign up [direct]
  62. MCPJam [direct]
  63. inspector [direct]
  64. Notifications [direct]
  65. Issues 52 [direct]
  66. Pull requests 238 [direct]
  67. Discussions [direct]
  68. Actions [direct]
  69. Projects [direct]
  70. Security and quality 1 [direct]
  71. Insights [direct]
  72. inspector [direct]
  73. .github [direct]
  74. workflows [direct]
  75. View runs [direct]
  76. History [direct]
  77. Raw [direct]
  78. Terms [direct]
  79. Privacy [direct]
  80. Security [direct]