HttpRequest Automate

Automate merge request management on GitLab with the HttpRequest Automate workflow. This scheduled workflow checks for existing merge requests, creates new ones if none exist, and manages the closing of outdated requests. It enhances efficiency by integrating batch processing and timed waits, ensuring smooth operations and timely approvals, ultimately streamlining your development process.

7/8/2025
10 nodes
Medium
schedulemediumsplitinbatcheswaitschedule triggerautomationapiintegrationlogicconditionalcron
Categories:
Schedule TriggeredMedium Workflow
Integrations:
SplitInBatchesWaitSchedule Trigger

Target Audience

This workflow is ideal for:
- Developers who need to automate the process of managing merge requests in GitLab.
- Project Managers looking to streamline their code review and merging processes.
- DevOps Engineers seeking to integrate CI/CD pipelines with automated merge request handling.
- Teams that require consistent and timely updates on merge request statuses and comments.
- Automation Enthusiasts interested in utilizing n8n for workflow automation.

Problem Solved

This workflow addresses the challenge of managing merge requests efficiently by automating the following tasks:
- Checking for existing merge requests to avoid duplicates.
- Creating new merge requests when none exist, ensuring that development work is not lost.
- Closing existing merge requests that are no longer relevant, keeping the repository clean.
- Adding custom notes to merge requests for better communication among team members.
- Waiting for a specified duration to allow for pipeline completion before merging, ensuring stability in the codebase.

Workflow Steps

  • Schedule Trigger: The workflow starts based on a defined schedule.
    2. API to Check Existing Merge Request: It queries GitLab to check if there are any opened merge requests for a specific source branch.
    3. Is Exists: A conditional check determines if any merge requests are found.
    4. Create New Merge Request: If no existing merge requests are found, a new merge request is created with the specified source and target branches.
    5. Add Custom Notes to Merge Request: Custom comments are added to the newly created merge request for context.
    6. 30 Seconds Wait: The workflow pauses for 30 seconds to allow for approvals and pipeline completion.
    7. Set Values for Merge: Prepares parameters for the merge request, indicating whether to remove the source branch after merging.
    8. Merge When Pipeline Succeeds: Finally, it merges the request once the pipeline succeeds, ensuring that the integration is stable.
  • Customization Guide

    To customize this workflow:
    - Modify API Endpoints: Change the GitLab API URLs to match your project ID.
    - Adjust Query Parameters: Update query parameters for checking merge requests based on your specific branch names.
    - Change Merge Request Details: Edit the body parameters when creating a merge request to include different titles or descriptions.
    - Set Wait Duration: Adjust the wait time to accommodate your CI/CD pipeline's average completion time.
    - Add Additional Nodes: Integrate other n8n nodes to extend functionality, such as notifications or logging.