Skip to content

feat: implement auto approval with pre-receive hooks#33

Merged
dcoric merged 20 commits intoG-Research-Forks:mainfrom
fabiovincenzi:auto-approve
Apr 7, 2025
Merged

feat: implement auto approval with pre-receive hooks#33
dcoric merged 20 commits intoG-Research-Forks:mainfrom
fabiovincenzi:auto-approve

Conversation

@fabiovincenzi
Copy link
Copy Markdown
Collaborator

@fabiovincenzi fabiovincenzi commented Mar 13, 2025

Summary

This PR is based on #11 and it introduces automatic approval and rejection for push actions by using pre-receive hooks.

Changes

  1. Backend

    • Introduced autoApproved and autoRejected properties in Action.js to track automatic approvals and rejections.
    • Added setAllowAutoApproval() and setAutoRejection() methods to mark actions as auto-approved or auto-rejected.
    • Implemented attemptAutoApproval() and attemptAutoRejection() to automatically authorize or reject actions when applicable.
    • Updated pre-receive hook processing to recognize when a push should be auto-approved or auto-rejected.
  2. Frontend

    • Updated PushDetails.jsx:
      • Disabled interaction with approval icons for auto-approved actions.
      • Adjusted cursor and opacity to indicate non-interactive elements.
      • Modified the attestation modal behavior to prevent opening for auto-approved action.
Screenshot 2025-03-25 at 16 37 10
  1. Tests & Pre-Receive Hook Changes

    • Added tests for automatic approvals and rejections in chain.test.js and preReceive.test.js.
    • Updated pre-receive hooks to return appropriate status codes for auto-approved, manually approved, and rejected pushes.
    • Verified that database operations (authorise and reject) are correctly called for auto-approved and auto-rejected actions.
  2. Documentation

    • Created pre-receive.md documentation to clarify the functionality of the pre-receive hook.

@fabiovincenzi fabiovincenzi linked an issue Mar 13, 2025 that may be closed by this pull request
@fabiovincenzi fabiovincenzi self-assigned this Mar 13, 2025
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 21, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 95.55556% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@83e814b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/proxy/actions/Action.js 50.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #33   +/-   ##
=======================================
  Coverage        ?   62.54%           
=======================================
  Files           ?       50           
  Lines           ?     1842           
  Branches        ?        0           
=======================================
  Hits            ?     1152           
  Misses          ?      690           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dcoric dcoric merged commit 61947df into G-Research-Forks:main Apr 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Auto-Approval for Pushes Using Pre-Receive Hook

3 participants