Skip to content

fix(auto-approve): add trusted author#5786

Open
TBonnin wants to merge 2 commits intomasterfrom
tbonnin/apr2/auto-approve-contributor
Open

fix(auto-approve): add trusted author#5786
TBonnin wants to merge 2 commits intomasterfrom
tbonnin/apr2/auto-approve-contributor

Conversation

@TBonnin
Copy link
Copy Markdown
Collaborator

@TBonnin TBonnin commented Apr 3, 2026

Harden docs auto-approval workflow with explicit trusted-author checks

This PR updates .github/workflows/auto-approve-docs.yml to replace the prior job-level author_association gate with an explicit trust evaluation step using actions/github-script@v7. The workflow now considers a PR trusted only if the author is mintlify[bot], has collaborator permission write or admin, or is an active member of the engineers team.

The job now always starts, but all downstream steps (Checkout, path filtering, app token generation, and auto-approval) are guarded by steps.trust_check.outputs.result == 'true'. Docs-only enforcement via dorny/paths-filter@v4 remains, and Approve PR now requires both trust and steps.filter.outputs.non_docs == 'false'.


This summary was automatically generated by @propel-code-bot

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

propel-code-bot[bot]

This comment was marked as outdated.

@TBonnin TBonnin closed this Apr 3, 2026
@TBonnin TBonnin changed the title fix(auto-approve): add CONTRIBUTOR fix(auto-approve): add trusted author Apr 3, 2026
@TBonnin TBonnin reopened this Apr 3, 2026
propel-code-bot[bot]

This comment was marked as outdated.

propel-code-bot[bot]

This comment was marked as outdated.

@TBonnin TBonnin force-pushed the tbonnin/apr2/auto-approve-contributor branch from ffc873e to ca83c2f Compare April 3, 2026 19:26
@TBonnin TBonnin requested a review from a team April 3, 2026 19:28
propel-code-bot[bot]

This comment was marked as outdated.

@TBonnin TBonnin force-pushed the tbonnin/apr2/auto-approve-contributor branch from ca83c2f to 4212107 Compare April 3, 2026 19:28
Copy link
Copy Markdown
Contributor

@propel-code-bot propel-code-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow trust checks are improved, but error handling may still cause avoidable failures.

Status: Changes Suggested | Risk: Medium

Issues Identified & Suggestions
  • Handle all GitHub API permission errors as untrusted, not workflow-failing: .github/workflows/auto-approve-docs.yml
Review Details

📁 1 files reviewed | 💬 1 comments

Instruction Files
└── .claude/
    ├── agents/
    │   └── nango-docs-migrator.md
    └── skills

👍 / 👎 individual comments to help improve reviews for you

username: login,
});
if (['write', 'admin'].includes(data.permission)) return true;
} catch (err) { if (err.status !== 404) throw err; }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

[Reliability] Non-404 errors from getCollaboratorPermissionLevel are re-thrown, but a 403 (insufficient token permissions — the workflow only has contents: read and pull-requests: write, not members: read or repo admin scope) will propagate and fail the entire workflow. The same applies to the team membership call on line 44. When the GitHub App token lacks the members permission, every PR from a collaborator or engineer will cause a workflow error instead of a graceful false result.

Change the catch clauses to treat any API error as "not trusted" rather than re-throwing:

Suggested change
} catch (err) { if (err.status !== 404) throw err; }
} catch (_err) {}
Context for Agents
Non-404 errors from `getCollaboratorPermissionLevel` are re-thrown, but a 403 (insufficient token permissions — the workflow only has `contents: read` and `pull-requests: write`, not `members: read` or repo admin scope) will propagate and fail the entire workflow. The same applies to the team membership call on line 44. When the GitHub App token lacks the `members` permission, every PR from a collaborator or engineer will cause a workflow error instead of a graceful `false` result.

Change the catch clauses to treat any API error as "not trusted" rather than re-throwing:
```suggestion
                      } catch (_err) {}
```

File: .github/workflows/auto-approve-docs.yml
Line: 34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants