Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(gitlab): manage projects, groups, labels, webhooks and CI/CD pipelines from flows and AI agents (#16396)

Odai Ahmad85c237646abf
diff --git a/bun.lock b/bun.lock
index c78f3e836ac..26b3aedbea3 100644
--- a/bun.lock
+++ b/bun.lock
@@ -3726,7 +3726,7 @@
},
"packages/pieces/community/gitlab": {
"name": "@activepieces/piece-gitlab",
- "version": "0.3.0",
+ "version": "0.4.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/gitlab/package.json b/packages/pieces/community/gitlab/package.json
index f5f972445c1..1d4d9b79e40 100644
--- a/packages/pieces/community/gitlab/package.json
+++ b/packages/pieces/community/gitlab/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-gitlab",
- "version": "0.3.0",
+ "version": "0.4.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/gitlab/src/i18n/translation.json b/packages/pieces/community/gitlab/src/i18n/translation.json
index c7e673b86c9..0339d091bc6 100644
--- a/packages/pieces/community/gitlab/src/i18n/translation.json
+++ b/packages/pieces/community/gitlab/src/i18n/translation.json
@@ -55,6 +55,64 @@
"Get User": "Get User",
"List Users": "List Users",
"Set User Status": "Set User Status",
+ "Cancel Job": "Cancel Job",
+ "Cancel Pipeline": "Cancel Pipeline",
+ "Run Pipeline": "Run Pipeline",
+ "Delete Pipeline": "Delete Pipeline",
+ "Erase Job": "Erase Job",
+ "Get Job Log": "Get Job Log",
+ "Get Job": "Get Job",
+ "Get Pipeline": "Get Pipeline",
+ "List Pipeline Jobs": "List Pipeline Jobs",
+ "List Pipelines": "List Pipelines",
+ "Play Manual Job": "Play Manual Job",
+ "Retry Pipeline": "Retry Pipeline",
+ "Archive Project": "Archive Project",
+ "Create Project": "Create Project",
+ "Delete Project": "Delete Project",
+ "Fork Project": "Fork Project",
+ "Get Project Languages": "Get Project Languages",
+ "Get Project Member": "Get Project Member",
+ "Get Project": "Get Project",
+ "Import Project Members": "Import Project Members",
+ "List Group Projects": "List Group Projects",
+ "List Project Ancestor Groups": "List Project Ancestor Groups",
+ "List Project Invited Groups": "List Project Invited Groups",
+ "List Project Members": "List Project Members",
+ "List Project Share Locations": "List Project Share Locations",
+ "List Project Transfer Locations": "List Project Transfer Locations",
+ "List Project Users": "List Project Users",
+ "List Projects": "List Projects",
+ "List User Projects": "List User Projects",
+ "Share Project With Group": "Share Project With Group",
+ "Star Project": "Star Project",
+ "Unarchive Project": "Unarchive Project",
+ "Unstar Project": "Unstar Project",
+ "Create Group": "Create Group",
+ "Delete Group": "Delete Group",
+ "Get Group Member": "Get Group Member",
+ "Get Group": "Get Group",
+ "List Group Billable Members": "List Group Billable Members",
+ "List Group Members": "List Group Members",
+ "List Group Pending Members": "List Group Pending Members",
+ "List Groups": "List Groups",
+ "Update Group": "Update Group",
+ "Create Label": "Create Label",
+ "Create Milestone": "Create Milestone",
+ "Delete Label": "Delete Label",
+ "Delete Milestone": "Delete Milestone",
+ "Get Label": "Get Label",
+ "Get Milestone": "Get Milestone",
+ "List Labels": "List Labels",
+ "List Milestones": "List Milestones",
+ "Update Label": "Update Label",
+ "Update Milestone": "Update Milestone",
+ "Create Project Webhook": "Create Project Webhook",
+ "Delete Project Webhook": "Delete Project Webhook",
+ "Get Project Webhook": "Get Project Webhook",
+ "List Project Webhooks": "List Project Webhooks",
+ "Update Project Webhook": "Update Project Webhook",
+ "Get Merge Request Approval Rules": "Get Merge Request Approval Rules",
"Custom API Call": "Custom API Call",
"Create a project issue": "Create a project issue",
"Logs time spent on an issue.": "Logs time spent on an issue.",
@@ -111,6 +169,64 @@
"Gets a user by numeric ID.": "Gets a user by numeric ID.",
"Searches users by name, username or public email.": "Searches users by name, username or public email.",
"Sets the status of the connected user. Fields left empty keep their current value.": "Sets the status of the connected user. Fields left empty keep their current value.",
+ "Cancels a running or pending CI/CD job.": "Cancels a running or pending CI/CD job.",
+ "Cancels the running and pending jobs of a pipeline.": "Cancels the running and pending jobs of a pipeline.",
+ "Starts a new CI/CD pipeline for a branch or tag.": "Starts a new CI/CD pipeline for a branch or tag.",
+ "Permanently deletes a pipeline with its jobs, logs and artifacts.": "Permanently deletes a pipeline with its jobs, logs and artifacts.",
+ "Permanently erases the log and artifacts of a finished job.": "Permanently erases the log and artifacts of a finished job.",
+ "Gets the end of a job console log.": "Gets the end of a job console log.",
+ "Gets one CI/CD job with its status and timings.": "Gets one CI/CD job with its status and timings.",
+ "Gets one pipeline with its status and timings.": "Gets one pipeline with its status and timings.",
+ "Lists the jobs of a pipeline, one page at a time.": "Lists the jobs of a pipeline, one page at a time.",
+ "Lists the CI/CD pipelines of a project, newest first, one page at a time.": "Lists the CI/CD pipelines of a project, newest first, one page at a time.",
+ "Starts a manual CI/CD job.": "Starts a manual CI/CD job.",
+ "Retries the failed and canceled jobs of a pipeline.": "Retries the failed and canceled jobs of a pipeline.",
+ "Archives a project, making it read-only.": "Archives a project, making it read-only.",
+ "Creates a new project in your namespace or in a group.": "Creates a new project in your namespace or in a group.",
+ "Deletes a project. On gitlab.com it is marked for deletion and removed after the retention period.": "Deletes a project. On gitlab.com it is marked for deletion and removed after the retention period.",
+ "Forks a project into your namespace or a group.": "Forks a project into your namespace or a group.",
+ "Gets the programming languages of a project repository with their share.": "Gets the programming languages of a project repository with their share.",
+ "Gets the membership and access level of one user in a project.": "Gets the membership and access level of one user in a project.",
+ "Gets one project by ID or full path.": "Gets one project by ID or full path.",
+ "Copies the members of another project into this project.": "Copies the members of another project into this project.",
+ "Lists the projects of a group, one page at a time.": "Lists the projects of a group, one page at a time.",
+ "Lists the groups a project belongs to (its parent groups), optionally with the groups it is shared with.": "Lists the groups a project belongs to (its parent groups), optionally with the groups it is shared with.",
+ "Lists the groups a project has been shared with.": "Lists the groups a project has been shared with.",
+ "Lists the members of a project, including members inherited from its groups.": "Lists the members of a project, including members inherited from its groups.",
+ "Lists the groups a project can be shared with.": "Lists the groups a project can be shared with.",
+ "Lists the groups a project can be moved to.": "Lists the groups a project can be moved to.",
+ "Lists the users who can be mentioned or assigned in a project.": "Lists the users who can be mentioned or assigned in a project.",
+ "Lists projects you are a member of, one page at a time.": "Lists projects you are a member of, one page at a time.",
+ "Lists the projects owned by a user that you can see.": "Lists the projects owned by a user that you can see.",
+ "Gives every member of a group access to a project.": "Gives every member of a group access to a project.",
+ "Stars a project for the connected user.": "Stars a project for the connected user.",
+ "Unarchives a project so it can be changed again.": "Unarchives a project so it can be changed again.",
+ "Removes the connected user star from a project.": "Removes the connected user star from a project.",
+ "Creates a group or a subgroup.": "Creates a group or a subgroup.",
+ "Deletes a group with its subgroups and projects. On gitlab.com it is marked for deletion and removed after the retention period.": "Deletes a group with its subgroups and projects. On gitlab.com it is marked for deletion and removed after the retention period.",
+ "Gets the direct membership and access level of one user in a group.": "Gets the direct membership and access level of one user in a group.",
+ "Gets one group by ID or full path.": "Gets one group by ID or full path.",
+ "Lists the members who count toward the paid seats of a top-level group.": "Lists the members who count toward the paid seats of a top-level group.",
+ "Lists the members of a group, one page at a time.": "Lists the members of a group, one page at a time.",
+ "Lists the members of a top-level group waiting for approval.": "Lists the members of a top-level group waiting for approval.",
+ "Lists the groups you are a member of, one page at a time.": "Lists the groups you are a member of, one page at a time.",
+ "Updates the name, path, description or visibility of a group. Fields left empty are not changed.": "Updates the name, path, description or visibility of a group. Fields left empty are not changed.",
+ "Creates a label in a project.": "Creates a label in a project.",
+ "Creates a milestone in a project.": "Creates a milestone in a project.",
+ "Permanently deletes a project label.": "Permanently deletes a project label.",
+ "Permanently deletes a project milestone.": "Permanently deletes a project milestone.",
+ "Gets one project label by ID or name.": "Gets one project label by ID or name.",
+ "Gets one project milestone by its ID.": "Gets one project milestone by its ID.",
+ "Lists the labels of a project, one page at a time.": "Lists the labels of a project, one page at a time.",
+ "Lists the milestones of a project, one page at a time.": "Lists the milestones of a project, one page at a time.",
+ "Renames or recolors a project label. Fields left empty are not changed.": "Renames or recolors a project label. Fields left empty are not changed.",
+ "Updates, closes or reopens a project milestone. Fields left empty are not changed.": "Updates, closes or reopens a project milestone. Fields left empty are not changed.",
+ "Adds a webhook to a project that calls a URL on the chosen events.": "Adds a webhook to a project that calls a URL on the chosen events.",
+ "Permanently deletes a project webhook.": "Permanently deletes a project webhook.",
+ "Gets one project webhook with its URL and events.": "Gets one project webhook with its URL and events.",
+ "Lists the webhooks of a project.": "Lists the webhooks of a project.",
+ "Changes the URL, events or secret token of a project webhook. Fields left empty are not changed.": "Changes the URL, events or secret token of a project webhook. Fields left empty are not changed.",
+ "Gets the approval rules of a merge request and which are satisfied. Rules need GitLab Premium or Ultimate.": "Gets the approval rules of a merge request and which are satisfied. Rules need GitLab Premium or Ultimate.",
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
"Project": "Project",
"Issue Title": "Issue Title",
@@ -202,6 +318,66 @@
"Availability": "Availability",
"Clear Status After": "Clear Status After",
"Clear Whole Status": "Clear Whole Status",
+ "Job ID": "Job ID",
+ "Pipeline ID": "Pipeline ID",
+ "Variables": "Variables",
+ "Max Characters": "Max Characters",
+ "Statuses": "Statuses",
+ "Include Retried Jobs": "Include Retried Jobs",
+ "Status": "Status",
+ "Source": "Source",
+ "Triggered By Username": "Triggered By Username",
+ "Updated Before": "Updated Before",
+ "Job Variables": "Job Variables",
+ "Name": "Name",
+ "Path": "Path",
+ "Namespace ID": "Namespace ID",
+ "Visibility": "Visibility",
+ "Initialize With README": "Initialize With README",
+ "Default Branch": "Default Branch",
+ "Target Namespace ID": "Target Namespace ID",
+ "Target Namespace Path": "Target Namespace Path",
+ "New Name": "New Name",
+ "New Path": "New Path",
+ "Include Inherited": "Include Inherited",
+ "Source Project ID": "Source Project ID",
+ "Group ID or Path": "Group ID or Path",
+ "Include Subgroups": "Include Subgroups",
+ "Archived": "Archived",
+ "Include Shared Groups": "Include Shared Groups",
+ "Shared Minimum Access Level": "Shared Minimum Access Level",
+ "Minimum Access Level": "Minimum Access Level",
+ "Member Only": "Member Only",
+ "Owned Only": "Owned Only",
+ "Group ID": "Group ID",
+ "Access Level": "Access Level",
+ "Expires At": "Expires At",
+ "Parent Group ID": "Parent Group ID",
+ "Top-Level Only": "Top-Level Only",
+ "Color": "Color",
+ "Priority": "Priority",
+ "Start Date": "Start Date",
+ "Label ID or Name": "Label ID or Name",
+ "Include Group Labels": "Include Group Labels",
+ "Exact Title": "Exact Title",
+ "Include Group Milestones": "Include Group Milestones",
+ "Remove Priority": "Remove Priority",
+ "Clear Start Date": "Clear Start Date",
+ "URL": "URL",
+ "Secret Token": "Secret Token",
+ "Push Branch Filter": "Push Branch Filter",
+ "SSL Verification": "SSL Verification",
+ "Push Events": "Push Events",
+ "Tag Push Events": "Tag Push Events",
+ "Issue Events": "Issue Events",
+ "Confidential Issue Events": "Confidential Issue Events",
+ "Merge Request Events": "Merge Request Events",
+ "Comment Events": "Comment Events",
+ "Pipeline Events": "Pipeline Events",
+ "Job Events": "Job Events",
+ "Release Events": "Release Events",
+ "Wiki Page Events": "Wiki Page Events",
+ "Webhook ID": "Webhook ID",
"Method": "Method",
"Headers": "Headers",
"Query Parameters": "Query Parameters",
@@ -272,6 +448,70 @@
"Up to 100 characters.": "Up to 100 characters.",
"Emoji name without colons, e.g. coffee or palm_tree.": "Emoji name without colons, e.g. coffee or palm_tree.",
"Removes message, emoji and availability. Other fields are ignored.": "Removes message, emoji and availability. Other fields are ignored.",
+ "Numeric job ID. Find it with List Pipeline Jobs.": "Numeric job ID. Find it with List Pipeline Jobs.",
+ "Numeric pipeline ID (not the pipeline IID). Find it with List Pipelines.": "Numeric pipeline ID (not the pipeline IID). Find it with List Pipelines.",
+ "Branch or tag to run the pipeline on.": "Branch or tag to run the pipeline on.",
+ "Pipeline variables as name to value, e.g. DEPLOY_ENV = staging.": "Pipeline variables as name to value, e.g. DEPLOY_ENV = staging.",
+ "Characters kept from the end of the log. Default 20000, max 100000.": "Characters kept from the end of the log. Default 20000, max 100000.",
+ "Only jobs in these statuses. Leave empty for all.": "Only jobs in these statuses. Leave empty for all.",
+ "Leave empty to hide earlier attempts of retried jobs.": "Leave empty to hide earlier attempts of retried jobs.",
+ "e.g. push, web, api, schedule, merge_request_event.": "e.g. push, web, api, schedule, merge_request_event.",
+ "Variables as name to value for this run.": "Variables as name to value for this run.",
+ "Display name. Required unless Path is set.": "Display name. Required unless Path is set.",
+ "URL slug. Defaults to the name.": "URL slug. Defaults to the name.",
+ "Numeric ID of the group to create the project in (Get Group returns it). Empty = your personal namespace.": "Numeric ID of the group to create the project in (Get Group returns it). Empty = your personal namespace.",
+ "Leave empty for the GitLab default.": "Leave empty for the GitLab default.",
+ "Create a first commit with a README.": "Create a first commit with a README.",
+ "Only applied together with Initialize With README.": "Only applied together with Initialize With README.",
+ "Numeric ID or full path of the project to fork.": "Numeric ID or full path of the project to fork.",
+ "Numeric ID of the group to fork into. Empty = your personal namespace.": "Numeric ID of the group to fork into. Empty = your personal namespace.",
+ "Full path of the group to fork into. Use instead of Target Namespace ID.": "Full path of the group to fork into. Use instead of Target Namespace ID.",
+ "Leave empty to copy the source visibility.": "Leave empty to copy the source visibility.",
+ "Numeric GitLab user ID. Find it with List Users.": "Numeric GitLab user ID. Find it with List Users.",
+ "Also match members inherited from groups.": "Also match members inherited from groups.",
+ "Numeric ID or full path of the project that receives the members.": "Numeric ID or full path of the project that receives the members.",
+ "Numeric ID of the project to copy the members from (a path is rejected by GitLab). Get Project returns it.": "Numeric ID of the project to copy the members from (a path is rejected by GitLab). Get Project returns it.",
+ "Numeric group ID or full path, e.g. `my-group/sub-group`.": "Numeric group ID or full path, e.g. `my-group/sub-group`.",
+ "Matches project name and path.": "Matches project name and path.",
+ "Also list projects in subgroups.": "Also list projects in subgroups.",
+ "Yes = only archived, No = only active, empty = both.": "Yes = only archived, No = only active, empty = both.",
+ "Only projects with this visibility.": "Only projects with this visibility.",
+ "Text to match against names.": "Text to match against names.",
+ "Also list groups the project is shared with.": "Also list groups the project is shared with.",
+ "Only shared groups with at least this access.": "Only shared groups with at least this access.",
+ "Only groups where the connected user has at least this access.": "Only groups where the connected user has at least this access.",
+ "Matches name, username or public email.": "Matches name, username or public email.",
+ "Matches name and username.": "Matches name and username.",
+ "Defaults to yes. Set to no only together with Search or Owned Only.": "Defaults to yes. Set to no only together with Search or Owned Only.",
+ "Only projects owned by the connected user.": "Only projects owned by the connected user.",
+ "Numeric ID of the group to share with.": "Numeric ID of the group to share with.",
+ "Role the group members get in the project.": "Role the group members get in the project.",
+ "YYYY-MM-DD. Empty = no expiry.": "YYYY-MM-DD. Empty = no expiry.",
+ "URL slug, e.g. my-team.": "URL slug, e.g. my-team.",
+ "Numeric ID of the parent group, for a subgroup.": "Numeric ID of the parent group, for a subgroup.",
+ "Leave empty for the GitLab default. A subgroup cannot be more visible than its parent.": "Leave empty for the GitLab default. A subgroup cannot be more visible than its parent.",
+ "Numeric ID or path of a top-level group.": "Numeric ID or path of a top-level group.",
+ "Matches name, username or email.": "Matches name, username or email.",
+ "Also list members inherited from parent groups.": "Also list members inherited from parent groups.",
+ "Matches group name and path.": "Matches group name and path.",
+ "Only groups the connected user owns.": "Only groups the connected user owns.",
+ "Hide subgroups.": "Hide subgroups.",
+ "Only groups where the connected user has at least this role.": "Only groups where the connected user has at least this role.",
+ "New URL slug. Changes every project URL in the group.": "New URL slug. Changes every project URL in the group.",
+ "Hex color such as #FF0000, or a CSS color name.": "Hex color such as #FF0000, or a CSS color name.",
+ "Whole number, 0 or more; lower sorts first. Empty = no priority.": "Whole number, 0 or more; lower sorts first. Empty = no priority.",
+ "Numeric label ID or the exact label name.": "Numeric label ID or the exact label name.",
+ "The global milestone `id` (not the `iid` shown in the GitLab UI). Find it with List Milestones.": "The global milestone `id` (not the `iid` shown in the GitLab UI). Find it with List Milestones.",
+ "Also look in labels inherited from parent groups.": "Also look in labels inherited from parent groups.",
+ "Matches the label name.": "Matches the label name.",
+ "Leave empty for the GitLab default (yes).": "Leave empty for the GitLab default (yes).",
+ "Also list milestones of parent groups.": "Also list milestones of parent groups.",
+ "Whole number, 0 or more.": "Whole number, 0 or more.",
+ "Address GitLab will POST events to.": "Address GitLab will POST events to.",
+ "Sent by GitLab in the X-Gitlab-Token header so the receiver can verify calls. Never returned in the output.": "Sent by GitLab in the X-Gitlab-Token header so the receiver can verify calls. Never returned in the output.",
+ "Only push events for branches matching this wildcard, e.g. main or release/*.": "Only push events for branches matching this wildcard, e.g. main or release/*.",
+ "Numeric webhook ID. Find it with List Project Webhooks.": "Numeric webhook ID. Find it with List Project Webhooks.",
+ "Leave empty to keep the current URL.": "Leave empty to keep the current URL.",
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
"Appended to the URL as ?key=value.": "Appended to the URL as ?key=value.",
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
@@ -287,7 +527,6 @@
"Opened": "Opened",
"Closed": "Closed",
"All": "All",
- "Priority": "Priority",
"Close": "Close",
"Reopen": "Reopen",
"Created by Me": "Created by Me",
@@ -301,7 +540,6 @@
"Branches": "Branches",
"Tags": "Tags",
"Updated": "Updated",
- "Name": "Name",
"Version": "Version",
"No one": "No one",
"Developers and Maintainers": "Developers and Maintainers",
@@ -315,6 +553,34 @@
"3 days": "3 days",
"7 days": "7 days",
"30 days": "30 days",
+ "created": "created",
+ "pending": "pending",
+ "running": "running",
+ "failed": "failed",
+ "success": "success",
+ "canceled": "canceled",
+ "skipped": "skipped",
+ "waiting_for_resource": "waiting_for_resource",
+ "manual": "manual",
+ "preparing": "preparing",
+ "scheduled": "scheduled",
+ "ID": "ID",
+ "Ref": "Ref",
+ "Private": "Private",
+ "Public": "Public",
+ "Last Activity": "Last Activity",
+ "Guest": "Guest",
+ "Planner": "Planner",
+ "Reporter": "Reporter",
+ "Developer": "Developer",
+ "Maintainer": "Maintainer",
+ "Owner": "Owner",
+ "Last activity, newest first": "Last activity, newest first",
+ "Last activity, oldest first": "Last activity, oldest first",
+ "Name A-Z": "Name A-Z",
+ "Name Z-A": "Name Z-A",
+ "Active": "Active",
+ "Reactivate": "Reactivate",
"GET": "GET",
"POST": "POST",
"PATCH": "PATCH",
diff --git a/packages/pieces/community/gitlab/src/index.ts b/packages/pieces/community/gitlab/src/index.ts
index aabfd444ae6..8a526f9f596 100644
--- a/packages/pieces/community/gitlab/src/index.ts
+++ b/packages/pieces/community/gitlab/src/index.ts
@@ -56,6 +56,64 @@ import { getUserStatusAction } from './lib/actions/users/get-user-status';
import { getUserAction } from './lib/actions/users/get-user';
import { listUsersAction } from './lib/actions/users/list-users';
import { setUserStatusAction } from './lib/actions/users/set-user-status';
+import { cancelJobAction } from './lib/actions/ci/cancel-job';
+import { cancelPipelineAction } from './lib/actions/ci/cancel-pipeline';
+import { createPipelineAction } from './lib/actions/ci/create-pipeline';
+import { deletePipelineAction } from './lib/actions/ci/delete-pipeline';
+import { eraseJobAction } from './lib/actions/ci/erase-job';
+import { getJobLogAction } from './lib/actions/ci/get-job-log';
+import { getJobAction } from './lib/actions/ci/get-job';
+import { getPipelineAction } from './lib/actions/ci/get-pipeline';
+import { listPipelineJobsAction } from './lib/actions/ci/list-pipeline-jobs';
+import { listPipelinesAction } from './lib/actions/ci/list-pipelines';
+import { playManualJobAction } from './lib/actions/ci/play-manual-job';
+import { retryPipelineAction } from './lib/actions/ci/retry-pipeline';
+import { archiveProjectAction } from './lib/actions/projects/archive-project';
+import { createProjectAction } from './lib/actions/projects/create-project';
+import { deleteProjectAction } from './lib/actions/projects/delete-project';
+import { forkProjectAction } from './lib/actions/projects/fork-project';
+import { getProjectLanguagesAction } from './lib/actions/projects/get-project-languages';
+import { getProjectMemberAction } from './lib/actions/projects/get-project-member';
+import { getProjectAction } from './lib/actions/projects/get-project';
+import { importProjectMembersAction } from './lib/actions/projects/import-project-members';
+import { listGroupProjectsAction } from './lib/actions/projects/list-group-projects';
+import { listProjectGroupsAction } from './lib/actions/projects/list-project-groups';
+import { listProjectInvitedGroupsAction } from './lib/actions/projects/list-project-invited-groups';
+import { listProjectMembersAction } from './lib/actions/projects/list-project-members';
+import { listProjectShareLocationsAction } from './lib/actions/projects/list-project-share-locations';
+import { listProjectTransferLocationsAction } from './lib/actions/projects/list-project-transfer-locations';
+import { listProjectUsersAction } from './lib/actions/projects/list-project-users';
+import { listProjectsAction } from './lib/actions/projects/list-projects';
+import { listUserProjectsAction } from './lib/actions/projects/list-user-projects';
+import { shareProjectWithGroupAction } from './lib/actions/projects/share-project-with-group';
+import { starProjectAction } from './lib/actions/projects/star-project';
+import { unarchiveProjectAction } from './lib/actions/projects/unarchive-project';
+import { unstarProjectAction } from './lib/actions/projects/unstar-project';
+import { createGroupAction } from './lib/actions/groups/create-group';
+import { deleteGroupAction } from './lib/actions/groups/delete-group';
+import { getGroupMemberAction } from './lib/actions/groups/get-group-member';
+import { getGroupAction } from './lib/actions/groups/get-group';
+import { listGroupBillableMembersAction } from './lib/actions/groups/list-group-billable-members';
+import { listGroupMembersAction } from './lib/actions/groups/list-group-members';
+import { listGroupPendingMembersAction } from './lib/actions/groups/list-group-pending-members';
+import { listGroupsAction } from './lib/actions/groups/list-groups';
+import { updateGroupAction } from './lib/actions/groups/update-group';
+import { createLabelAction } from './lib/actions/labels/create-label';
+import { createMilestoneAction } from './lib/actions/labels/create-milestone';
+import { deleteLabelAction } from './lib/actions/labels/delete-label';
+import { deleteMilestoneAction } from './lib/actions/labels/delete-milestone';
+import { getLabelAction } from './lib/actions/labels/get-label';
+import { getMilestoneAction } from './lib/actions/labels/get-milestone';
+import { listLabelsAction } from './lib/actions/labels/list-labels';
+import { listMilestonesAction } from './lib/actions/labels/list-milestones';
+import { updateLabelAction } from './lib/actions/labels/update-label';
+import { updateMilestoneAction } from './lib/actions/labels/update-milestone';
+import { createProjectWebhookAction } from './lib/actions/webhooks/create-project-webhook';
+import { deleteProjectWebhookAction } from './lib/actions/webhooks/delete-project-webhook';
+import { getProjectWebhookAction } from './lib/actions/webhooks/get-project-webhook';
+import { listProjectWebhooksAction } from './lib/actions/webhooks/list-project-webhooks';
+import { updateProjectWebhookAction } from './lib/actions/webhooks/update-project-webhook';
+import { getMergeRequestApprovalStateAction } from './lib/actions/merge-requests/get-merge-request-approval-state';
import { issuesEventTrigger } from './lib/trigger/issue-event';
import { gitlabAuth } from './lib/auth';
import { GITLAB_API_BASE } from './lib/common/constants';
@@ -125,6 +183,64 @@ export const gitlab = createPiece({
getUserAction,
listUsersAction,
setUserStatusAction,
+ cancelJobAction,
+ cancelPipelineAction,
+ createPipelineAction,
+ deletePipelineAction,
+ eraseJobAction,
+ getJobLogAction,
+ getJobAction,
+ getPipelineAction,
+ listPipelineJobsAction,
+ listPipelinesAction,
+ playManualJobAction,
+ retryPipelineAction,
+ archiveProjectAction,
+ createProjectAction,
+ deleteProjectAction,
+ forkProjectAction,
+ getProjectLanguagesAction,
+ getProjectMemberAction,
+ getProjectAction,
+ importProjectMembersAction,
+ listGroupProjectsAction,
+ listProjectGroupsAction,
+ listProjectInvitedGroupsAction,
+ listProjectMembersAction,
+ listProjectShareLocationsAction,
+ listProjectTransferLocationsAction,
+ listProjectUsersAction,
+ listProjectsAction,
+ listUserProjectsAction,
+ shareProjectWithGroupAction,
+ starProjectAction,
+ unarchiveProjectAction,
+ unstarProjectAction,
+ createGroupAction,
+ deleteGroupAction,
+ getGroupMemberAction,
+ getGroupAction,
+ listGroupBillableMembersAction,
+ listGroupMembersAction,
+ listGroupPendingMembersAction,
+ listGroupsAction,
+ updateGroupAction,
+ createLabelAction,
+ createMilestoneAction,
+ deleteLabelAction,
+ deleteMilestoneAction,
+ getLabelAction,
+ getMilestoneAction,
+ listLabelsAction,
+ listMilestonesAction,
+ updateLabelAction,
+ updateMilestoneAction,
+ createProjectWebhookAction,
+ deleteProjectWebhookAction,
+ getProjectWebhookAction,
+ listProjectWebhooksAction,
+ updateProjectWebhookAction,
+ getMergeRequestApprovalStateAction,
createCustomApiCallAction({
baseUrl: () => GITLAB_API_BASE,
auth: gitlabAuth,
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-job.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-job.ts
new file mode 100644
index 00000000000..6226b56e325
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-job.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { cancelJob } from '../../common/irreversible';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { jobOutputSchema } from '../../output-schemas-admin';
+
+export const cancelJobAction = createAction({
+ auth: gitlabAuth,
+ name: 'cancel_job',
+ displayName: 'Cancel Job',
+ description: 'Cancels a running or pending CI/CD job.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Cancels one running or pending GitLab CI/CD job; it stops and cannot be resumed (a retry is a new job run). Cancelling a finished job changes nothing. Use Cancel Pipeline to stop every job of a pipeline.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ jobId: adminProps.jobId(),
+ },
+ outputSchema: jobOutputSchema,
+ async run({ auth, propsValue }) {
+ const jobId = requirePositiveInt({ value: propsValue.jobId, label: 'Job ID' });
+ return cancelJob({ auth, projectId: propsValue.projectId, jobId });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-pipeline.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-pipeline.ts
new file mode 100644
index 00000000000..956bc07186c
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/cancel-pipeline.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { cancelPipeline } from '../../common/irreversible';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { pipelineOutputSchema } from '../../output-schemas-admin';
+
+export const cancelPipelineAction = createAction({
+ auth: gitlabAuth,
+ name: 'cancel_pipeline',
+ displayName: 'Cancel Pipeline',
+ description: 'Cancels the running and pending jobs of a pipeline.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Cancels a running or pending GitLab pipeline; its unfinished jobs stop and cannot be resumed (Retry Pipeline starts the failed and canceled jobs again as new runs). Cancelling a finished pipeline changes nothing and returns it as is.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ pipelineId: adminProps.pipelineId(),
+ },
+ outputSchema: pipelineOutputSchema,
+ async run({ auth, propsValue }) {
+ const pipelineId = requirePositiveInt({ value: propsValue.pipelineId, label: 'Pipeline ID' });
+ return cancelPipeline({ auth, projectId: propsValue.projectId, pipelineId });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/create-pipeline.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/create-pipeline.ts
new file mode 100644
index 00000000000..8e2fde9fee4
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/create-pipeline.ts
@@ -0,0 +1,58 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requireText } from '../../common/props';
+import { isRecord } from '../../common/secret-request';
+import { pipelineOutputSchema } from '../../output-schemas-admin';
+
+export function pipelineVariables(value: unknown): Array<{ key: string; value: string; variable_type: string }> | undefined {
+ if (value === undefined || value === null) {
+ return undefined;
+ }
+ if (!isRecord(value)) {
+ throw new Error('Variables must be an object of name to value.');
+ }
+ const entries = Object.entries(value);
+ if (entries.length === 0) {
+ return undefined;
+ }
+ return entries.map(([key, raw]) => {
+ const name = key.trim();
+ if (!/^[A-Za-z0-9_]+$/.test(name)) {
+ throw new Error(`Variable name "${key}" may only contain letters, digits and underscores.`);
+ }
+ if (raw !== null && typeof raw === 'object') {
+ throw new Error(`Variable "${name}" must be a text value.`);
+ }
+ return { key: name, value: raw === undefined || raw === null ? '' : String(raw), variable_type: 'env_var' };
+ });
+}
+
+export const createPipelineAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_pipeline',
+ displayName: 'Run Pipeline',
+ description: 'Starts a new CI/CD pipeline for a branch or tag.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Starts a new GitLab CI/CD pipeline on a branch or tag, optionally with pipeline variables. Every call starts another pipeline. Returns the pipeline ID; follow it with Get Pipeline or List Pipeline Jobs. The project needs a .gitlab-ci.yml on that ref. Variables are refused (400 Insufficient permissions) unless the project CI/CD setting allows the connected user role to set pipeline variables; new gitlab.com projects allow no one by default.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ ref: Property.ShortText({ displayName: 'Branch or Tag', description: 'Branch or tag to run the pipeline on.', required: true }),
+ variables: Property.Object({ displayName: 'Variables', description: 'Pipeline variables as name to value, e.g. DEPLOY_ENV = staging.', required: false }),
+ },
+ outputSchema: pipelineOutputSchema,
+ async run({ auth, propsValue }) {
+ const ref = requireText({ value: propsValue.ref, label: 'Branch or Tag' });
+ const variables = pipelineVariables(propsValue.variables);
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/pipeline`,
+ body: { ref, variables },
+ statusMessages: { 400: 'GitLab could not create the pipeline (check the ref exists, has a valid .gitlab-ci.yml, and that the project allows your role to set pipeline variables)' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/delete-pipeline.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/delete-pipeline.ts
new file mode 100644
index 00000000000..b9ccd18ede8
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/delete-pipeline.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { deletedPipelineOutputSchema } from '../../output-schemas-admin';
+
+export const deletePipelineAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_pipeline',
+ displayName: 'Delete Pipeline',
+ description: 'Permanently deletes a pipeline with its jobs, logs and artifacts.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently deletes a GitLab pipeline together with its jobs, job logs and artifacts; it cannot be restored. Requires the Owner role. A second call fails with not found. Use Cancel Pipeline to only stop it.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ pipelineId: adminProps.pipelineId(),
+ },
+ outputSchema: deletedPipelineOutputSchema,
+ async run({ auth, propsValue }) {
+ const pipelineId = requirePositiveInt({ value: propsValue.pipelineId, label: 'Pipeline ID' });
+ await gitlabRequest({ auth, method: 'DELETE', path: `${projectPath(propsValue.projectId)}/pipelines/${pipelineId}` });
+ return { deleted: true, pipelineId };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/erase-job.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/erase-job.ts
new file mode 100644
index 00000000000..91329a13bca
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/erase-job.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { eraseJob } from '../../common/irreversible';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { jobOutputSchema } from '../../output-schemas-admin';
+
+export const eraseJobAction = createAction({
+ auth: gitlabAuth,
+ name: 'erase_job',
+ displayName: 'Erase Job',
+ description: 'Permanently erases the log and artifacts of a finished job.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently erases the console log and artifacts of a finished GitLab CI/CD job; they cannot be restored. The job record stays with erased_at set. Fails on a running job, and a second call on the same job fails.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ jobId: adminProps.jobId(),
+ },
+ outputSchema: jobOutputSchema,
+ async run({ auth, propsValue }) {
+ const jobId = requirePositiveInt({ value: propsValue.jobId, label: 'Job ID' });
+ return eraseJob({ auth, projectId: propsValue.projectId, jobId });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/get-job-log.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/get-job-log.ts
new file mode 100644
index 00000000000..93da3e9579b
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/get-job-log.ts
@@ -0,0 +1,55 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalPositiveInt, requirePositiveInt } from '../../common/props';
+import { jobLogOutputSchema } from '../../output-schemas-admin';
+
+const ANSI_ESCAPE = /\u001b\[[0-9;?]*[A-Za-z]/g;
+const SECTION_MARKER = /section_(?:start|end):\d+:[A-Za-z0-9_.-]+(?:\[[^\]\r\n]*\])?/g;
+
+export function cleanLog(text: string): string {
+ return text
+ .replace(ANSI_ESCAPE, '')
+ .replace(SECTION_MARKER, '')
+ .split('\n')
+ .map((line) => {
+ const body = line.replace(/\r+$/, '');
+ return body.slice(body.lastIndexOf('\r') + 1);
+ })
+ .join('\n');
+}
+
+export const getJobLogAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_job_log',
+ displayName: 'Get Job Log',
+ description: 'Gets the end of a job console log.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns the console log (trace) of a GitLab CI/CD job, keeping only the last Max Characters (default 20000, up to 100000) because errors are usually at the end, with terminal color codes removed; truncated says whether the start was cut. Use to explain why a job failed.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ jobId: adminProps.jobId(),
+ maxChars: Property.Number({ displayName: 'Max Characters', description: 'Characters kept from the end of the log. Default 20000, max 100000.', required: false }),
+ },
+ outputSchema: jobLogOutputSchema,
+ async run({ auth, propsValue }) {
+ const jobId = requirePositiveInt({ value: propsValue.jobId, label: 'Job ID' });
+ const maxChars = optionalPositiveInt({ value: propsValue.maxChars, label: 'Max Characters' }) ?? DEFAULT_LOG_CHARS;
+ if (maxChars > MAX_LOG_CHARS) {
+ throw new Error(`Max Characters must be at most ${MAX_LOG_CHARS}.`);
+ }
+ const raw = await gitlabRequest<unknown>({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/jobs/${jobId}/trace` });
+ const text = cleanLog(typeof raw === 'string' ? raw : raw === undefined || raw === null ? '' : JSON.stringify(raw));
+ const truncated = text.length > maxChars;
+ return { jobId, log: truncated ? text.slice(text.length - maxChars) : text, truncated, totalLength: text.length };
+ },
+});
+
+export const DEFAULT_LOG_CHARS = 20_000;
+
+export const MAX_LOG_CHARS = 100_000;
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/get-job.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/get-job.ts
new file mode 100644
index 00000000000..70b66627e6f
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/get-job.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { jobOutputSchema } from '../../output-schemas-admin';
+
+export const getJobAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_job',
+ displayName: 'Get Job',
+ description: 'Gets one CI/CD job with its status and timings.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab CI/CD job by its numeric ID: name, stage, status, failure reason, timings, commit and pipeline. Use Get Job Log for its console output.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ jobId: adminProps.jobId(),
+ },
+ outputSchema: jobOutputSchema,
+ async run({ auth, propsValue }) {
+ const jobId = requirePositiveInt({ value: propsValue.jobId, label: 'Job ID' });
+ return gitlabRequest({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/jobs/${jobId}` });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/get-pipeline.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/get-pipeline.ts
new file mode 100644
index 00000000000..54c27ef15e9
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/get-pipeline.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { pipelineOutputSchema } from '../../output-schemas-admin';
+
+export const getPipelineAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_pipeline',
+ displayName: 'Get Pipeline',
+ description: 'Gets one pipeline with its status and timings.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab CI/CD pipeline by its numeric ID: status (created, pending, running, success, failed, canceled, skipped, manual), ref, SHA, who triggered it, timings and URL. Use List Pipeline Jobs for its jobs.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ pipelineId: adminProps.pipelineId(),
+ },
+ outputSchema: pipelineOutputSchema,
+ async run({ auth, propsValue }) {
+ const pipelineId = requirePositiveInt({ value: propsValue.pipelineId, label: 'Pipeline ID' });
+ return gitlabRequest({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/pipelines/${pipelineId}` });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipeline-jobs.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipeline-jobs.ts
new file mode 100644
index 00000000000..8a8a9306fcd
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipeline-jobs.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, pagingInput, requirePositiveInt, stringList, triStateValue } from '../../common/props';
+import { jobListOutputSchema } from '../../output-schemas-admin';
+
+export const JOB_SCOPES = ['created', 'pending', 'running', 'failed', 'success', 'canceled', 'skipped', 'waiting_for_resource', 'manual'];
+
+export const listPipelineJobsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_pipeline_jobs',
+ displayName: 'List Pipeline Jobs',
+ description: 'Lists the jobs of a pipeline, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the jobs of one GitLab pipeline with their stage and status, optionally filtered by status. Returns one page plus nextPage/hasMore. Use to find a job ID for Get Job Log, Play Manual Job, Cancel Job or Erase Job.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ pipelineId: adminProps.pipelineId(),
+ scope: Property.StaticMultiSelectDropdown({
+ displayName: 'Statuses',
+ description: 'Only jobs in these statuses. Leave empty for all.',
+ required: false,
+ options: { options: JOB_SCOPES.map((value) => ({ label: value, value })) },
+ }),
+ includeRetried: gitlabProps.triState('Include Retried Jobs', 'Leave empty to hide earlier attempts of retried jobs.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: jobListOutputSchema,
+ async run({ auth, propsValue }) {
+ const pipelineId = requirePositiveInt({ value: propsValue.pipelineId, label: 'Pipeline ID' });
+ const scope = stringList({ value: propsValue.scope, label: 'Statuses' });
+ const unknown = scope?.filter((value) => !JOB_SCOPES.includes(value)) ?? [];
+ if (unknown.length > 0) {
+ throw new Error(`Unknown job status: ${unknown.join(', ')}. Use one of ${JOB_SCOPES.join(', ')}.`);
+ }
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/pipelines/${pipelineId}/jobs`,
+ query: { scope, include_retried: triStateValue(propsValue.includeRetried) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipelines.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipelines.ts
new file mode 100644
index 00000000000..23ae53b5d1f
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/list-pipelines.ts
@@ -0,0 +1,60 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalIsoDate, optionalText, pagingInput } from '../../common/props';
+import { pipelineListOutputSchema } from '../../output-schemas-admin';
+
+export const PIPELINE_STATUSES = ['created', 'waiting_for_resource', 'preparing', 'pending', 'running', 'success', 'failed', 'canceled', 'skipped', 'manual', 'scheduled'];
+
+export const listPipelinesAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_pipelines',
+ displayName: 'List Pipelines',
+ description: 'Lists the CI/CD pipelines of a project, newest first, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists GitLab CI/CD pipelines of a project with optional filters (status, branch or tag, commit SHA, source, triggering username, updated after/before). Returns one page plus nextPage/hasMore. Use to find a pipeline ID for Get Pipeline, Retry Pipeline or Cancel Pipeline.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ status: Property.StaticDropdown({
+ displayName: 'Status',
+ required: false,
+ options: { options: PIPELINE_STATUSES.map((value) => ({ label: value, value })) },
+ }),
+ ref: Property.ShortText({ displayName: 'Branch or Tag', required: false }),
+ sha: Property.ShortText({ displayName: 'Commit SHA', required: false }),
+ source: Property.ShortText({ displayName: 'Source', description: 'e.g. push, web, api, schedule, merge_request_event.', required: false }),
+ username: Property.ShortText({ displayName: 'Triggered By Username', required: false }),
+ updatedAfter: Property.ShortText({ displayName: 'Updated After', description: 'ISO 8601 date-time.', required: false }),
+ updatedBefore: Property.ShortText({ displayName: 'Updated Before', description: 'ISO 8601 date-time.', required: false }),
+ orderBy: Property.StaticDropdown({
+ displayName: 'Order By',
+ required: false,
+ options: { options: [{ label: 'ID', value: 'id' }, { label: 'Status', value: 'status' }, { label: 'Ref', value: 'ref' }, { label: 'Updated At', value: 'updated_at' }, { label: 'User ID', value: 'user_id' }] },
+ }),
+ sort: gitlabProps.sort(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: pipelineListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/pipelines`,
+ query: {
+ status: propsValue.status,
+ ref: optionalText(propsValue.ref),
+ sha: optionalText(propsValue.sha),
+ source: optionalText(propsValue.source),
+ username: optionalText(propsValue.username)?.replace(/^@/, ''),
+ updated_after: optionalIsoDate({ value: propsValue.updatedAfter, label: 'Updated After' }),
+ updated_before: optionalIsoDate({ value: propsValue.updatedBefore, label: 'Updated Before' }),
+ order_by: propsValue.orderBy,
+ sort: propsValue.sort,
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/play-manual-job.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/play-manual-job.ts
new file mode 100644
index 00000000000..921665f8823
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/play-manual-job.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { jobOutputSchema } from '../../output-schemas-admin';
+import { pipelineVariables } from './create-pipeline';
+
+export const playManualJobAction = createAction({
+ auth: gitlabAuth,
+ name: 'play_manual_job',
+ displayName: 'Play Manual Job',
+ description: 'Starts a manual CI/CD job.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Starts a GitLab CI/CD job that waits for a manual action (status manual), e.g. a deploy step, optionally with job variables. Only works on manual jobs; a job that already ran fails with a 400 or 403. Find manual jobs with List Pipeline Jobs filtered to manual.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ jobId: adminProps.jobId(),
+ variables: Property.Object({ displayName: 'Job Variables', description: 'Variables as name to value for this run.', required: false }),
+ },
+ outputSchema: jobOutputSchema,
+ async run({ auth, propsValue }) {
+ const jobId = requirePositiveInt({ value: propsValue.jobId, label: 'Job ID' });
+ const variables = pipelineVariables(propsValue.variables)?.map(({ key, value }) => ({ key, value }));
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/jobs/${jobId}/play`,
+ body: variables ? { job_variables_attributes: variables } : undefined,
+ statusMessages: {
+ 400: 'GitLab could not start the job (only jobs waiting for a manual action can be played)',
+ 403: 'The job is not a manual job waiting to run, or the connected user may not run it',
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/ci/retry-pipeline.ts b/packages/pieces/community/gitlab/src/lib/actions/ci/retry-pipeline.ts
new file mode 100644
index 00000000000..d594b7ebb82
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/ci/retry-pipeline.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { pipelineOutputSchema } from '../../output-schemas-admin';
+
+export const retryPipelineAction = createAction({
+ auth: gitlabAuth,
+ name: 'retry_pipeline',
+ displayName: 'Retry Pipeline',
+ description: 'Retries the failed and canceled jobs of a pipeline.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Retries the failed or canceled jobs of a GitLab pipeline as new job runs in the same pipeline. Each call queues new job runs, so do not repeat it while the pipeline is still running. Use Run Pipeline to start a fresh pipeline instead.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ pipelineId: adminProps.pipelineId(),
+ },
+ outputSchema: pipelineOutputSchema,
+ async run({ auth, propsValue }) {
+ const pipelineId = requirePositiveInt({ value: propsValue.pipelineId, label: 'Pipeline ID' });
+ return gitlabRequest({ auth, method: 'POST', path: `${projectPath(propsValue.projectId)}/pipelines/${pipelineId}/retry` });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/create-group.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/create-group.ts
new file mode 100644
index 00000000000..e2554cb0d9b
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/create-group.ts
@@ -0,0 +1,40 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { optionalPositiveInt, optionalText, requireText } from '../../common/props';
+import { groupOutputSchema } from '../../output-schemas-admin';
+
+export const createGroupAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_group',
+ displayName: 'Create Group',
+ description: 'Creates a group or a subgroup.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Creates a GitLab group, or a subgroup when Parent Group ID is set. On gitlab.com new top-level groups usually cannot be created through the API, so create subgroups under a group where the connected user is Owner or Maintainer. A path already taken fails with 400.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', required: true }),
+ path: Property.ShortText({ displayName: 'Path', description: 'URL slug, e.g. my-team.', required: true }),
+ parentId: Property.Number({ displayName: 'Parent Group ID', description: 'Numeric ID of the parent group, for a subgroup.', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ visibility: adminProps.visibility('Leave empty for the GitLab default. A subgroup cannot be more visible than its parent.'),
+ },
+ outputSchema: groupOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: '/groups',
+ body: {
+ name: requireText({ value: propsValue.name, label: 'Name' }),
+ path: requireText({ value: propsValue.path, label: 'Path' }),
+ parent_id: optionalPositiveInt({ value: propsValue.parentId, label: 'Parent Group ID' }),
+ description: optionalText(propsValue.description),
+ visibility: propsValue.visibility ?? undefined,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/delete-group.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/delete-group.ts
new file mode 100644
index 00000000000..2f6c186dac1
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/delete-group.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { requireText } from '../../common/props';
+import { vendorMessage } from '../../common/secret-request';
+import { deletedGroupOutputSchema } from '../../output-schemas-admin';
+
+export const deleteGroupAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_group',
+ displayName: 'Delete Group',
+ description: 'Deletes a group with its subgroups and projects. On gitlab.com it is marked for deletion and removed after the retention period.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Deletes a GitLab group together with all its subgroups and projects. On gitlab.com the group is first marked for deletion and removed after the retention period (an Owner can restore it in the UI until then). Requires the Owner role.',
+ idempotent: false,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ },
+ outputSchema: deletedGroupOutputSchema,
+ async run({ auth, propsValue }) {
+ const groupId = requireText({ value: propsValue.groupId, label: 'Group ID or path' });
+ const body = await gitlabRequest<unknown>({ auth, method: 'DELETE', path: groupPath(groupId) });
+ return { deletionRequested: true, groupId, message: vendorMessage(body) ?? null };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/get-group-member.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/get-group-member.ts
new file mode 100644
index 00000000000..6306b3407c5
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/get-group-member.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { requirePositiveInt } from '../../common/props';
+import { memberOutputSchema } from '../../output-schemas-admin';
+
+export const getGroupMemberAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_group_member',
+ displayName: 'Get Group Member',
+ description: 'Gets the direct membership and access level of one user in a group.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one user direct membership in a GitLab group with the access level (10 Guest, 20 Reporter, 30 Developer, 40 Maintainer, 50 Owner). Members inherited from a parent group are not found here; use List Group Members with Include Inherited for those.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ userId: adminProps.userId(),
+ },
+ outputSchema: memberOutputSchema,
+ async run({ auth, propsValue }) {
+ const userId = requirePositiveInt({ value: propsValue.userId, label: 'User ID' });
+ return gitlabRequest({ auth,
+ method: 'GET',
+ path: `${groupPath(propsValue.groupId)}/members/${userId}`,
+ statusMessages: { 404: 'This user is not a direct member of the group (or the group was not found)' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/get-group.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/get-group.ts
new file mode 100644
index 00000000000..57ea0d2b654
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/get-group.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { groupOutputSchema } from '../../output-schemas-admin';
+
+export const getGroupAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_group',
+ displayName: 'Get Group',
+ description: 'Gets one group by ID or full path.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab group by numeric ID or full path: name, numeric ID, full path, visibility, parent group and URL. Use it to turn a group path into the numeric ID other actions need. Use List Group Projects for its projects.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ },
+ outputSchema: groupOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth, method: 'GET', path: groupPath(propsValue.groupId), query: { with_projects: false } });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-billable-members.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-billable-members.ts
new file mode 100644
index 00000000000..6fefa9ced43
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-billable-members.ts
@@ -0,0 +1,46 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { billableMemberListOutputSchema } from '../../output-schemas-admin';
+
+export const listGroupBillableMembersAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_group_billable_members',
+ displayName: 'List Group Billable Members',
+ description: 'Lists the members who count toward the paid seats of a top-level group.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the billable members (used seats) of a top-level GitLab group, including members of its subgroups and projects, with last activity. Only works on a top-level group and requires the Owner role. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId('Numeric ID or path of a top-level group.'),
+ search: adminProps.search('Matches name, username or email.'),
+ sort: Property.StaticDropdown({
+ displayName: 'Sort',
+ required: false,
+ options: {
+ options: [
+ { label: 'Last activity, newest first', value: 'last_activity_on_desc' },
+ { label: 'Last activity, oldest first', value: 'last_activity_on_asc' },
+ { label: 'Name A-Z', value: 'name_asc' },
+ { label: 'Name Z-A', value: 'name_desc' },
+ ],
+ },
+ }),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: billableMemberListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${groupPath(propsValue.groupId)}/billable_members`,
+ query: { search: optionalText(propsValue.search), sort: propsValue.sort },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ statusMessages: { 400: 'Billable members are only available on a top-level group' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-members.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-members.ts
new file mode 100644
index 00000000000..a3a76d10c56
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-members.ts
@@ -0,0 +1,35 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { memberListOutputSchema } from '../../output-schemas-admin';
+
+export const listGroupMembersAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_group_members',
+ displayName: 'List Group Members',
+ description: 'Lists the members of a group, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists members of a GitLab group with their access level. Only direct members by default; set Include Inherited to add members inherited from parent groups. Optional name search. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ includeInherited: gitlabProps.triState('Include Inherited', 'Also list members inherited from parent groups.'),
+ query: adminProps.search('Matches name, username or public email.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: memberListOutputSchema,
+ async run({ auth, propsValue }) {
+ const scope = propsValue.includeInherited === 'true' ? 'members/all' : 'members';
+ return gitlabListPage({ auth,
+ path: `${groupPath(propsValue.groupId)}/${scope}`,
+ query: { query: optionalText(propsValue.query) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-pending-members.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-pending-members.ts
new file mode 100644
index 00000000000..4b1dbb9662a
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/list-group-pending-members.ts
@@ -0,0 +1,31 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, pagingInput } from '../../common/props';
+import { pendingMemberListOutputSchema } from '../../output-schemas-admin';
+
+export const listGroupPendingMembersAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_group_pending_members',
+ displayName: 'List Group Pending Members',
+ description: 'Lists the members of a top-level group waiting for approval.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists members of a top-level GitLab group (and its subgroups and projects) that are awaiting Owner approval, for example because of a user cap, including pending email invitations. Requires the Owner role on a top-level group. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId('Numeric ID or path of a top-level group.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: pendingMemberListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${groupPath(propsValue.groupId)}/pending_members`,
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/list-groups.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/list-groups.ts
new file mode 100644
index 00000000000..e9293b3d8b9
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/list-groups.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, optionalAccessLevel } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { groupListOutputSchema } from '../../output-schemas-admin';
+
+export const listGroupsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_groups',
+ displayName: 'List Groups',
+ description: 'Lists the groups you are a member of, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists GitLab groups and subgroups the connected user is a member of, with optional search, owned-only, top-level-only and minimum access level filters. Search can miss a group created moments ago; use Get Group by path for that. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ search: adminProps.search('Matches group name and path.'),
+ owned: gitlabProps.triState('Owned Only', 'Only groups the connected user owns.'),
+ topLevelOnly: gitlabProps.triState('Top-Level Only', 'Hide subgroups.'),
+ minAccessLevel: adminProps.accessLevel('Minimum Access Level', false, 'Only groups where the connected user has at least this role.'),
+ orderBy: Property.StaticDropdown({
+ displayName: 'Order By',
+ required: false,
+ options: { options: [{ label: 'Name', value: 'name' }, { label: 'Path', value: 'path' }, { label: 'ID', value: 'id' }] },
+ }),
+ sort: gitlabProps.sort(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: groupListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: '/groups',
+ query: {
+ search: optionalText(propsValue.search),
+ owned: triStateValue(propsValue.owned),
+ top_level_only: triStateValue(propsValue.topLevelOnly),
+ min_access_level: optionalAccessLevel({ value: propsValue.minAccessLevel, label: 'Minimum Access Level' }),
+ order_by: propsValue.orderBy,
+ sort: propsValue.sort,
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/groups/update-group.ts b/packages/pieces/community/gitlab/src/lib/actions/groups/update-group.ts
new file mode 100644
index 00000000000..76efbe3de47
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/groups/update-group.ts
@@ -0,0 +1,42 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { optionalText } from '../../common/props';
+import { groupOutputSchema } from '../../output-schemas-admin';
+
+export const updateGroupAction = createAction({
+ auth: gitlabAuth,
+ name: 'update_group',
+ displayName: 'Update Group',
+ description: 'Updates the name, path, description or visibility of a group. Fields left empty are not changed.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Changes a GitLab group name, path, description or visibility. Only the fields you set are sent; use Clear Description to blank it. Changing the path changes the URL of the group and of every project in it. Requires the Owner role.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ path: Property.ShortText({ displayName: 'Path', description: 'New URL slug. Changes every project URL in the group.', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ clearDescription: Property.Checkbox({ displayName: 'Clear Description', required: false, defaultValue: false }),
+ visibility: adminProps.visibility('Leave empty to keep the current value.'),
+ },
+ outputSchema: groupOutputSchema,
+ async run({ auth, propsValue }) {
+ const body: Record<string, unknown> = {};
+ const name = optionalText(propsValue.name);
+ if (name !== undefined) body['name'] = name;
+ const path = optionalText(propsValue.path);
+ if (path !== undefined) body['path'] = path;
+ if (propsValue.clearDescription === true) body['description'] = '';
+ else if (optionalText(propsValue.description) !== undefined) body['description'] = propsValue.description;
+ if (propsValue.visibility) body['visibility'] = propsValue.visibility;
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set at least one field to update.');
+ }
+ return gitlabRequest({ auth, method: 'PUT', path: groupPath(propsValue.groupId), body });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/create-label.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/create-label.ts
new file mode 100644
index 00000000000..e8cbec060bc
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/create-label.ts
@@ -0,0 +1,51 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { requireColor } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, requireText } from '../../common/props';
+import { labelOutputSchema } from '../../output-schemas-admin';
+
+export function optionalPriority(value: unknown): number | undefined {
+ if (value === undefined || value === null || value === '') {
+ return undefined;
+ }
+ const parsed = typeof value === 'string' ? Number(value) : value;
+ if (typeof parsed !== 'number' || !Number.isInteger(parsed) || parsed < 0) {
+ throw new Error('Priority must be a whole number of 0 or more.');
+ }
+ return parsed;
+}
+
+export const createLabelAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_label',
+ displayName: 'Create Label',
+ description: 'Creates a label in a project.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Creates a project label with a name and color, optionally a description and priority. A label with the same name already in the project fails with 409; check List Labels first. Apply labels to issues with Update Issue.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ name: Property.ShortText({ displayName: 'Name', required: true }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color such as #FF0000, or a CSS color name.', required: true }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ priority: Property.Number({ displayName: 'Priority', description: 'Whole number, 0 or more; lower sorts first. Empty = no priority.', required: false }),
+ },
+ outputSchema: labelOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/labels`,
+ body: {
+ name: requireText({ value: propsValue.name, label: 'Name' }),
+ color: requireColor({ value: propsValue.color, label: 'Color' }),
+ description: optionalText(propsValue.description),
+ priority: optionalPriority(propsValue.priority),
+ },
+ statusMessages: { 409: 'A label with this name already exists in the project' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/create-milestone.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/create-milestone.ts
new file mode 100644
index 00000000000..b518ef700fe
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/create-milestone.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { optionalDay } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, requireText } from '../../common/props';
+import { milestoneOutputSchema } from '../../output-schemas-admin';
+
+export const createMilestoneAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_milestone',
+ displayName: 'Create Milestone',
+ description: 'Creates a milestone in a project.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Creates a GitLab project milestone with a title and optional description, start date and due date. A title already used in the project fails with 400; check List Milestones first. The result id (not iid) is what Update Issue and the other milestone actions take.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ title: Property.ShortText({ displayName: 'Title', required: true }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ startDate: Property.ShortText({ displayName: 'Start Date', description: 'YYYY-MM-DD.', required: false }),
+ dueDate: Property.ShortText({ displayName: 'Due Date', description: 'YYYY-MM-DD.', required: false }),
+ },
+ outputSchema: milestoneOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/milestones`,
+ body: {
+ title: requireText({ value: propsValue.title, label: 'Title' }),
+ description: optionalText(propsValue.description),
+ start_date: optionalDay({ value: propsValue.startDate, label: 'Start Date' }),
+ due_date: optionalDay({ value: propsValue.dueDate, label: 'Due Date' }),
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/delete-label.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/delete-label.ts
new file mode 100644
index 00000000000..b6ef64753ab
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/delete-label.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { encodeSegment, gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requireText } from '../../common/props';
+import { deletedLabelOutputSchema } from '../../output-schemas-admin';
+
+export const deleteLabelAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_label',
+ displayName: 'Delete Label',
+ description: 'Permanently deletes a project label.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently deletes a GitLab project label and removes it from every issue and merge request that has it; it cannot be restored. A second call fails with not found. Group labels cannot be deleted here.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ labelId: adminProps.labelId(),
+ },
+ outputSchema: deletedLabelOutputSchema,
+ async run({ auth, propsValue }) {
+ const label = requireText({ value: propsValue.labelId, label: 'Label ID or Name' });
+ await gitlabRequest({ auth, method: 'DELETE', path: `${projectPath(propsValue.projectId)}/labels/${encodeSegment({ value: label, label: 'Label ID or Name' })}` });
+ return { deleted: true, label };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/delete-milestone.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/delete-milestone.ts
new file mode 100644
index 00000000000..31dca1babc7
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/delete-milestone.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { deletedMilestoneOutputSchema } from '../../output-schemas-admin';
+
+export const deleteMilestoneAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_milestone',
+ displayName: 'Delete Milestone',
+ description: 'Permanently deletes a project milestone.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently deletes a GitLab project milestone by its global id and unsets it on every issue and merge request; it cannot be restored. Requires the Planner, Reporter or higher role. A second call fails with not found. Use Update Milestone to close it instead.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ milestoneId: adminProps.milestoneId(),
+ },
+ outputSchema: deletedMilestoneOutputSchema,
+ async run({ auth, propsValue }) {
+ const milestoneId = requirePositiveInt({ value: propsValue.milestoneId, label: 'Milestone ID' });
+ await gitlabRequest({ auth, method: 'DELETE', path: `${projectPath(propsValue.projectId)}/milestones/${milestoneId}` });
+ return { deleted: true, milestoneId };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/get-label.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/get-label.ts
new file mode 100644
index 00000000000..2ce83a0efd0
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/get-label.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { encodeSegment, gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, triStateValue } from '../../common/props';
+import { labelOutputSchema } from '../../output-schemas-admin';
+
+export const getLabelAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_label',
+ displayName: 'Get Label',
+ description: 'Gets one project label by ID or name.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab project label by numeric ID or exact name: color, description, priority and whether it is a project or group label. Group labels are found when Include Group Labels is yes.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ labelId: adminProps.labelId(),
+ includeAncestorGroups: gitlabProps.triState('Include Group Labels', 'Also look in labels inherited from parent groups.'),
+ },
+ outputSchema: labelOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth,
+ method: 'GET',
+ path: `${projectPath(propsValue.projectId)}/labels/${encodeSegment({ value: propsValue.labelId, label: 'Label ID or Name' })}`,
+ query: { include_ancestor_groups: triStateValue(propsValue.includeAncestorGroups) },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/get-milestone.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/get-milestone.ts
new file mode 100644
index 00000000000..7acb1a5f8fd
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/get-milestone.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { milestoneOutputSchema } from '../../output-schemas-admin';
+
+export const getMilestoneAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_milestone',
+ displayName: 'Get Milestone',
+ description: 'Gets one project milestone by its ID.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab project milestone by its global id (not the iid shown in the UI): title, description, state, start and due dates, expired flag and URL. Find the id with List Milestones.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ milestoneId: adminProps.milestoneId(),
+ },
+ outputSchema: milestoneOutputSchema,
+ async run({ auth, propsValue }) {
+ const milestoneId = requirePositiveInt({ value: propsValue.milestoneId, label: 'Milestone ID' });
+ return gitlabRequest({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/milestones/${milestoneId}` });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/list-labels.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/list-labels.ts
new file mode 100644
index 00000000000..804d1d71b9b
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/list-labels.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { labelListOutputSchema } from '../../output-schemas-admin';
+
+export const listLabelsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_labels',
+ displayName: 'List Labels',
+ description: 'Lists the labels of a project, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the labels available in a GitLab project, including labels inherited from parent groups unless Include Group Labels is no, with optional name search. Returns one page plus nextPage/hasMore. Use to check a label exists before Create Label or Update Issue.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search('Matches the label name.'),
+ includeAncestorGroups: gitlabProps.triState('Include Group Labels', 'Leave empty for the GitLab default (yes).'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: labelListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/labels`,
+ query: { search: optionalText(propsValue.search), include_ancestor_groups: triStateValue(propsValue.includeAncestorGroups) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/list-milestones.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/list-milestones.ts
new file mode 100644
index 00000000000..00105fa7836
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/list-milestones.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { milestoneListOutputSchema } from '../../output-schemas-admin';
+
+export const listMilestonesAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_milestones',
+ displayName: 'List Milestones',
+ description: 'Lists the milestones of a project, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists GitLab project milestones with optional state (active or closed), exact title and text search filters. Returns one page plus nextPage/hasMore. Each item has the global id (used by Get Milestone, Update Milestone and Update Issue) and the iid.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ state: Property.StaticDropdown({
+ displayName: 'State',
+ required: false,
+ options: { options: [{ label: 'Active', value: 'active' }, { label: 'Closed', value: 'closed' }] },
+ }),
+ title: Property.ShortText({ displayName: 'Exact Title', required: false }),
+ search: adminProps.search('Matches title and description.'),
+ includeAncestors: gitlabProps.triState('Include Group Milestones', 'Also list milestones of parent groups.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: milestoneListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/milestones`,
+ query: {
+ state: propsValue.state,
+ title: optionalText(propsValue.title),
+ search: optionalText(propsValue.search),
+ include_ancestors: triStateValue(propsValue.includeAncestors),
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/update-label.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/update-label.ts
new file mode 100644
index 00000000000..ec4f3dd3c43
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/update-label.ts
@@ -0,0 +1,53 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, requireColor } from '../../common/admin';
+import { encodeSegment, gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalText } from '../../common/props';
+import { labelOutputSchema } from '../../output-schemas-admin';
+import { optionalPriority } from './create-label';
+
+export const updateLabelAction = createAction({
+ auth: gitlabAuth,
+ name: 'update_label',
+ displayName: 'Update Label',
+ description: 'Renames or recolors a project label. Fields left empty are not changed.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Changes a GitLab project label: new name, color, description or priority. Only the fields you set are sent; use the Clear options to remove the description or priority. Renaming updates the label on every issue and merge request that has it. Group labels cannot be changed here.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ labelId: adminProps.labelId(),
+ newName: Property.ShortText({ displayName: 'New Name', required: false }),
+ color: Property.ShortText({ displayName: 'Color', description: 'Hex color such as #FF0000, or a CSS color name.', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ clearDescription: Property.Checkbox({ displayName: 'Clear Description', required: false, defaultValue: false }),
+ priority: Property.Number({ displayName: 'Priority', description: 'Whole number, 0 or more.', required: false }),
+ clearPriority: Property.Checkbox({ displayName: 'Remove Priority', required: false, defaultValue: false }),
+ },
+ outputSchema: labelOutputSchema,
+ async run({ auth, propsValue }) {
+ const body: Record<string, unknown> = {};
+ const newName = optionalText(propsValue.newName);
+ if (newName !== undefined) body['new_name'] = newName;
+ if (optionalText(propsValue.color) !== undefined) body['color'] = requireColor({ value: propsValue.color, label: 'Color' });
+ if (propsValue.clearDescription === true) body['description'] = '';
+ else if (optionalText(propsValue.description) !== undefined) body['description'] = propsValue.description;
+ if (propsValue.clearPriority === true) body['priority'] = null;
+ else {
+ const priority = optionalPriority(propsValue.priority);
+ if (priority !== undefined) body['priority'] = priority;
+ }
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set at least one field to update.');
+ }
+ return gitlabRequest({ auth,
+ method: 'PUT',
+ path: `${projectPath(propsValue.projectId)}/labels/${encodeSegment({ value: propsValue.labelId, label: 'Label ID or Name' })}`,
+ body,
+ statusMessages: { 409: 'A label with the new name already exists in the project' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/labels/update-milestone.ts b/packages/pieces/community/gitlab/src/lib/actions/labels/update-milestone.ts
new file mode 100644
index 00000000000..1883a821acc
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/labels/update-milestone.ts
@@ -0,0 +1,59 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, optionalDay } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, requirePositiveInt } from '../../common/props';
+import { milestoneOutputSchema } from '../../output-schemas-admin';
+
+export const updateMilestoneAction = createAction({
+ auth: gitlabAuth,
+ name: 'update_milestone',
+ displayName: 'Update Milestone',
+ description: 'Updates, closes or reopens a project milestone. Fields left empty are not changed.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Changes a GitLab project milestone: title, description, start and due dates, or closes / reactivates it. Takes the global milestone id. Only the fields you set are sent; use the Clear options to blank the description or a date.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ milestoneId: adminProps.milestoneId(),
+ title: Property.ShortText({ displayName: 'Title', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ clearDescription: Property.Checkbox({ displayName: 'Clear Description', required: false, defaultValue: false }),
+ startDate: Property.ShortText({ displayName: 'Start Date', description: 'YYYY-MM-DD.', required: false }),
+ clearStartDate: Property.Checkbox({ displayName: 'Clear Start Date', required: false, defaultValue: false }),
+ dueDate: Property.ShortText({ displayName: 'Due Date', description: 'YYYY-MM-DD.', required: false }),
+ clearDueDate: Property.Checkbox({ displayName: 'Clear Due Date', required: false, defaultValue: false }),
+ stateEvent: Property.StaticDropdown({
+ displayName: 'State Change',
+ required: false,
+ options: { options: [{ label: 'Close', value: 'close' }, { label: 'Reactivate', value: 'activate' }] },
+ }),
+ },
+ outputSchema: milestoneOutputSchema,
+ async run({ auth, propsValue }) {
+ const milestoneId = requirePositiveInt({ value: propsValue.milestoneId, label: 'Milestone ID' });
+ const body: Record<string, unknown> = {};
+ const title = optionalText(propsValue.title);
+ if (title !== undefined) body['title'] = title;
+ if (propsValue.clearDescription === true) body['description'] = '';
+ else if (optionalText(propsValue.description) !== undefined) body['description'] = propsValue.description;
+ if (propsValue.clearStartDate === true) body['start_date'] = '';
+ else {
+ const start = optionalDay({ value: propsValue.startDate, label: 'Start Date' });
+ if (start !== undefined) body['start_date'] = start;
+ }
+ if (propsValue.clearDueDate === true) body['due_date'] = '';
+ else {
+ const due = optionalDay({ value: propsValue.dueDate, label: 'Due Date' });
+ if (due !== undefined) body['due_date'] = due;
+ }
+ if (propsValue.stateEvent) body['state_event'] = propsValue.stateEvent;
+ if (Object.keys(body).length === 0) {
+ throw new Error('Set at least one field to update.');
+ }
+ return gitlabRequest({ auth, method: 'PUT', path: `${projectPath(propsValue.projectId)}/milestones/${milestoneId}`, body });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/merge-requests/get-merge-request-approval-state.ts b/packages/pieces/community/gitlab/src/lib/actions/merge-requests/get-merge-request-approval-state.ts
new file mode 100644
index 00000000000..302c0875c3d
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/merge-requests/get-merge-request-approval-state.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { approvalStateOutputSchema } from '../../output-schemas-admin';
+
+export const getMergeRequestApprovalStateAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_merge_request_approval_state',
+ displayName: 'Get Merge Request Approval Rules',
+ description: 'Gets the approval rules of a merge request and which are satisfied. Rules need GitLab Premium or Ultimate.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns the approval rules that apply to a GitLab merge request (eligible approvers, approvals required per rule, who approved, whether each rule is met). Rules are a GitLab Premium or Ultimate feature; on Free the list is empty or the call fails with 403 or 404, so use Get Merge Request Approvals there.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ mergeRequestIid: gitlabProps.mergeRequestIid(),
+ },
+ outputSchema: approvalStateOutputSchema,
+ async run({ auth, propsValue }) {
+ const iid = requirePositiveInt({ value: propsValue.mergeRequestIid, label: 'Merge Request IID' });
+ return gitlabRequest({ auth,
+ method: 'GET',
+ path: `${projectPath(propsValue.projectId)}/merge_requests/${iid}/approval_state`,
+ statusMessages: {
+ 403: 'Approval rules need GitLab Premium or Ultimate on this project, or the connected user lacks access',
+ 404: 'GitLab could not find the merge request, or approval rules are not available on this GitLab plan',
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/merge-requests/list-merge-request-diffs.ts b/packages/pieces/community/gitlab/src/lib/actions/merge-requests/list-merge-request-diffs.ts
index b7de9409c59..886fe25a2cf 100644
--- a/packages/pieces/community/gitlab/src/lib/actions/merge-requests/list-merge-request-diffs.ts
+++ b/packages/pieces/community/gitlab/src/lib/actions/merge-requests/list-merge-request-diffs.ts
@@ -9,8 +9,6 @@ import {
} from '../../common/props';
import { diffListOutputSchema } from '../../output-schemas';
-export const MAX_DIFF_CHARS = 20_000;
-
export function capDiff(
diff: GitlabDiff
): GitlabDiff & { diffTruncated: boolean } {
@@ -53,3 +51,5 @@ export const listMergeRequestDiffsAction = createAction({
return { ...result, items: result.items.map(capDiff) };
},
});
+
+export const MAX_DIFF_CHARS = 20_000;
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/archive-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/archive-project.ts
new file mode 100644
index 00000000000..26c480c3857
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/archive-project.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabProps } from '../../common/props';
+import { archiveProject } from '../../common/irreversible';
+import { projectOutputSchema } from '../../output-schemas-admin';
+
+export const archiveProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'archive_project',
+ displayName: 'Archive Project',
+ description: 'Archives a project, making it read-only.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Archives a GitLab project: it becomes read-only (no pushes, issues, merge requests or pipelines) and is hidden from default lists. Requires Maintainer or Owner role. Archiving an archived project changes nothing. Undo with Unarchive Project.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectOutputSchema,
+ async run({ auth, propsValue }) {
+ return archiveProject({ auth, projectId: propsValue.projectId });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/create-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/create-project.ts
new file mode 100644
index 00000000000..3653d8bfee9
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/create-project.ts
@@ -0,0 +1,50 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest } from '../../common/client';
+import { optionalPositiveInt, optionalText } from '../../common/props';
+import { projectOutputSchema } from '../../output-schemas-admin';
+
+export const createProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_project',
+ displayName: 'Create Project',
+ description: 'Creates a new project in your namespace or in a group.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Creates a new GitLab project (repository) in the connected user namespace, or in a group when Namespace ID is set. Give a name, a path or both. Each call creates another project; a name or path already taken fails with 400. Visibility follows the GitLab default when empty.',
+ idempotent: false,
+ },
+ props: {
+ name: Property.ShortText({ displayName: 'Name', description: 'Display name. Required unless Path is set.', required: false }),
+ path: Property.ShortText({ displayName: 'Path', description: 'URL slug. Defaults to the name.', required: false }),
+ namespaceId: Property.Number({ displayName: 'Namespace ID', description: 'Numeric ID of the group to create the project in (Get Group returns it). Empty = your personal namespace.', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ visibility: adminProps.visibility('Leave empty for the GitLab default.'),
+ initializeWithReadme: Property.Checkbox({ displayName: 'Initialize With README', description: 'Create a first commit with a README.', required: false, defaultValue: false }),
+ defaultBranch: Property.ShortText({ displayName: 'Default Branch', description: 'Only applied together with Initialize With README.', required: false }),
+ },
+ outputSchema: projectOutputSchema,
+ async run({ auth, propsValue }) {
+ const name = optionalText(propsValue.name);
+ const path = optionalText(propsValue.path);
+ if (name === undefined && path === undefined) {
+ throw new Error('Set a Name or a Path for the new project.');
+ }
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: '/projects',
+ body: {
+ name,
+ path,
+ namespace_id: optionalPositiveInt({ value: propsValue.namespaceId, label: 'Namespace ID' }),
+ description: optionalText(propsValue.description),
+ visibility: propsValue.visibility ?? undefined,
+ initialize_with_readme: propsValue.initializeWithReadme === true ? true : undefined,
+ default_branch: propsValue.initializeWithReadme === true ? optionalText(propsValue.defaultBranch) : undefined,
+ },
+ });
+ },
+});
+
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/delete-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/delete-project.ts
new file mode 100644
index 00000000000..554824f26c6
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/delete-project.ts
@@ -0,0 +1,28 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requireText } from '../../common/props';
+import { vendorMessage } from '../../common/secret-request';
+import { deletedProjectOutputSchema } from '../../output-schemas-admin';
+
+export const deleteProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_project',
+ displayName: 'Delete Project',
+ description: 'Deletes a project. On gitlab.com it is marked for deletion and removed after the retention period.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Deletes a GitLab project with its repository, issues, merge requests and pipelines. On gitlab.com the project is first marked for deletion and removed after the retention period (an Owner can restore it in the UI until then). Requires the Owner role. Use Archive Project to make it read-only instead.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: deletedProjectOutputSchema,
+ async run({ auth, propsValue }) {
+ const projectId = requireText({ value: propsValue.projectId, label: 'Project ID or path' });
+ const body = await gitlabRequest<unknown>({ auth, method: 'DELETE', path: projectPath(projectId) });
+ return { deletionRequested: true, projectId, message: vendorMessage(body) ?? null };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/fork-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/fork-project.ts
new file mode 100644
index 00000000000..735f8b35ec5
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/fork-project.ts
@@ -0,0 +1,48 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalPositiveInt, optionalText } from '../../common/props';
+import { projectOutputSchema } from '../../output-schemas-admin';
+
+export const forkProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'fork_project',
+ displayName: 'Fork Project',
+ description: 'Forks a project into your namespace or a group.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Forks a GitLab project into the connected user namespace or a target group. The copy runs in the background: the result has import_status (scheduled, started, finished); poll Get Project on the new ID until it is finished. A second fork into the same namespace with the same path fails.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId('Numeric ID or full path of the project to fork.'),
+ namespaceId: Property.Number({ displayName: 'Target Namespace ID', description: 'Numeric ID of the group to fork into. Empty = your personal namespace.', required: false }),
+ namespacePath: Property.ShortText({ displayName: 'Target Namespace Path', description: 'Full path of the group to fork into. Use instead of Target Namespace ID.', required: false }),
+ name: Property.ShortText({ displayName: 'New Name', required: false }),
+ path: Property.ShortText({ displayName: 'New Path', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ visibility: adminProps.visibility('Leave empty to copy the source visibility.'),
+ },
+ outputSchema: projectOutputSchema,
+ async run({ auth, propsValue }) {
+ const namespaceId = optionalPositiveInt({ value: propsValue.namespaceId, label: 'Target Namespace ID' });
+ const namespacePath = optionalText(propsValue.namespacePath);
+ if (namespaceId !== undefined && namespacePath !== undefined) {
+ throw new Error('Set either Target Namespace ID or Target Namespace Path, not both.');
+ }
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/fork`,
+ body: {
+ namespace_id: namespaceId,
+ namespace_path: namespacePath,
+ name: optionalText(propsValue.name),
+ path: optionalText(propsValue.path),
+ description: optionalText(propsValue.description),
+ visibility: propsValue.visibility ?? undefined,
+ },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-languages.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-languages.ts
new file mode 100644
index 00000000000..6a290e347c6
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-languages.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps } from '../../common/props';
+import { projectLanguagesOutputSchema } from '../../output-schemas-admin';
+
+export const getProjectLanguagesAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_project_languages',
+ displayName: 'Get Project Languages',
+ description: 'Gets the programming languages of a project repository with their share.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns the programming languages detected in a GitLab project repository with the percentage of code in each, largest first. Empty for an empty repository.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectLanguagesOutputSchema,
+ async run({ auth, propsValue }) {
+ const body = await gitlabRequest<Record<string, number> | undefined>({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/languages` });
+ const languages = Object.entries(body ?? {})
+ .map(([language, percentage]) => ({ language, percentage: Number(percentage) }))
+ .sort((a, b) => b.percentage - a.percentage);
+ return { languages, count: languages.length };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-member.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-member.ts
new file mode 100644
index 00000000000..c4774a8a527
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project-member.ts
@@ -0,0 +1,34 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { memberOutputSchema } from '../../output-schemas-admin';
+
+export const getProjectMemberAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_project_member',
+ displayName: 'Get Project Member',
+ description: 'Gets the membership and access level of one user in a project.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one user membership in a GitLab project with the access level. By default only direct members are found; set Include Inherited to also find members who get access through a parent or shared group. Not found means the user is not a member.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ userId: adminProps.userId(),
+ includeInherited: gitlabProps.triState('Include Inherited', 'Also match members inherited from groups.'),
+ },
+ outputSchema: memberOutputSchema,
+ async run({ auth, propsValue }) {
+ const userId = requirePositiveInt({ value: propsValue.userId, label: 'User ID' });
+ const scope = propsValue.includeInherited === 'true' ? 'members/all' : 'members';
+ return gitlabRequest({ auth,
+ method: 'GET',
+ path: `${projectPath(propsValue.projectId)}/${scope}/${userId}`,
+ statusMessages: { 404: 'This user is not a member of the project (or the project was not found)' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/get-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project.ts
new file mode 100644
index 00000000000..c5a13911e10
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/get-project.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps } from '../../common/props';
+import { projectOutputSchema } from '../../output-schemas-admin';
+
+export const getProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_project',
+ displayName: 'Get Project',
+ description: 'Gets one project by ID or full path.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab project by numeric ID or full path (group/project): name, numeric ID, namespace, default branch, visibility, archived flag, stars, forks and clone URLs. Use it to turn a path into the numeric project ID.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth, method: 'GET', path: projectPath(propsValue.projectId) });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/import-project-members.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/import-project-members.ts
new file mode 100644
index 00000000000..8ce378e1e0c
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/import-project-members.ts
@@ -0,0 +1,65 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { GitlabApiError, isRecord } from '../../common/secret-request';
+import { importMembersOutputSchema } from '../../output-schemas-admin';
+
+type ImportResult = { status?: string; message?: unknown };
+
+function toImportResult(value: unknown): ImportResult | undefined {
+ if (!isRecord(value)) {
+ return undefined;
+ }
+ return { status: typeof value['status'] === 'string' ? value['status'] : undefined, message: value['message'] };
+}
+
+function perUserErrors(message: unknown): Array<{ user: string; message: string }> {
+ if (message === undefined || message === null) {
+ return [];
+ }
+ if (isRecord(message)) {
+ return Object.entries(message).map(([user, text]) => ({
+ user,
+ message: typeof text === 'string' ? text : JSON.stringify(text),
+ }));
+ }
+ return [{ user: '', message: typeof message === 'string' ? message : JSON.stringify(message) }];
+}
+
+export const importProjectMembersAction = createAction({
+ auth: gitlabAuth,
+ name: 'import_project_members',
+ displayName: 'Import Project Members',
+ description: 'Copies the members of another project into this project.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Copies the direct members of a source GitLab project into a target project with their roles; the source must be given as a numeric project ID. Members who cannot be added are listed in errors with the reason, and status is error when any failed. Running it again with the same members succeeded unchanged in testing. Requires Maintainer role on the target.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId('Numeric ID or full path of the project that receives the members.'),
+ sourceProjectId: Property.Number({ displayName: 'Source Project ID', description: 'Numeric ID of the project to copy the members from (a path is rejected by GitLab). Get Project returns it.', required: true }),
+ },
+ outputSchema: importMembersOutputSchema,
+ async run({ auth, propsValue }) {
+ const sourceProjectId = requirePositiveInt({ value: propsValue.sourceProjectId, label: 'Source Project ID' });
+ let result: ImportResult | undefined;
+ try {
+ result = await gitlabRequest<ImportResult | undefined>({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/import_project_members/${sourceProjectId}`,
+ });
+ } catch (error) {
+ const body = error instanceof GitlabApiError ? toImportResult(error.responseBody) : undefined;
+ if (error instanceof GitlabApiError && error.status === 422 && body?.status === 'error') {
+ result = body;
+ } else {
+ throw error;
+ }
+ }
+ const errors = result?.status === 'error' ? perUserErrors(result.message) : [];
+ return { status: result?.status ?? 'success', sourceProjectId, errors };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-group-projects.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-group-projects.ts
new file mode 100644
index 00000000000..fe6cd74ec62
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-group-projects.ts
@@ -0,0 +1,47 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, groupPath } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { projectListOutputSchema } from '../../output-schemas-admin';
+import { projectOrderBy } from './list-projects';
+
+export const listGroupProjectsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_group_projects',
+ displayName: 'List Group Projects',
+ description: 'Lists the projects of a group, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the projects in a GitLab group, optionally including its subgroups, with search, archived and visibility filters. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ groupId: adminProps.groupId(),
+ search: adminProps.search('Matches project name and path.'),
+ includeSubgroups: gitlabProps.triState('Include Subgroups', 'Also list projects in subgroups.'),
+ archived: gitlabProps.triState('Archived', 'Yes = only archived, No = only active, empty = both.'),
+ visibility: adminProps.visibility('Only projects with this visibility.'),
+ orderBy: projectOrderBy(),
+ sort: gitlabProps.sort(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: projectListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${groupPath(propsValue.groupId)}/projects`,
+ query: {
+ search: optionalText(propsValue.search),
+ include_subgroups: triStateValue(propsValue.includeSubgroups),
+ archived: triStateValue(propsValue.archived),
+ visibility: propsValue.visibility,
+ order_by: propsValue.orderBy,
+ sort: propsValue.sort,
+ simple: true,
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-groups.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-groups.ts
new file mode 100644
index 00000000000..e17e749ac08
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-groups.ts
@@ -0,0 +1,39 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, optionalAccessLevel } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { groupRefListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectGroupsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_groups',
+ displayName: 'List Project Ancestor Groups',
+ description: 'Lists the groups a project belongs to (its parent groups), optionally with the groups it is shared with.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the ancestor groups of a GitLab project (its parent group chain), and with Include Shared Groups also the groups it is shared with. Returns one page plus nextPage/hasMore. Use List Project Invited Groups for only the shared groups.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search(),
+ withShared: gitlabProps.triState('Include Shared Groups', 'Also list groups the project is shared with.'),
+ sharedMinAccessLevel: adminProps.accessLevel('Shared Minimum Access Level', false, 'Only shared groups with at least this access.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: groupRefListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/groups`,
+ query: {
+ search: optionalText(propsValue.search),
+ with_shared: triStateValue(propsValue.withShared),
+ shared_min_access_level: optionalAccessLevel({ value: propsValue.sharedMinAccessLevel, label: 'Shared Minimum Access Level' }),
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-invited-groups.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-invited-groups.ts
new file mode 100644
index 00000000000..48f3d8f75ce
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-invited-groups.ts
@@ -0,0 +1,37 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, optionalAccessLevel } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { groupRefListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectInvitedGroupsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_invited_groups',
+ displayName: 'List Project Invited Groups',
+ description: 'Lists the groups a project has been shared with.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the groups a GitLab project is shared with (invited groups), with optional name search and minimum access level. Returns one page plus nextPage/hasMore. Share a project with Share Project With Group.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search(),
+ minAccessLevel: adminProps.accessLevel('Minimum Access Level', false, 'Only groups where the connected user has at least this access.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: groupRefListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/invited_groups`,
+ query: {
+ search: optionalText(propsValue.search),
+ min_access_level: optionalAccessLevel({ value: propsValue.minAccessLevel, label: 'Minimum Access Level' }),
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-members.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-members.ts
new file mode 100644
index 00000000000..94a91265018
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-members.ts
@@ -0,0 +1,33 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { memberListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectMembersAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_members',
+ displayName: 'List Project Members',
+ description: 'Lists the members of a project, including members inherited from its groups.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists every member of a GitLab project with their access level (10 Guest, 20 Reporter, 30 Developer, 40 Maintainer, 50 Owner), including members inherited from parent groups and shared groups. Optional name search. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ query: adminProps.search('Matches name, username or public email.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: memberListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/members/all`,
+ query: { query: optionalText(propsValue.query) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-share-locations.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-share-locations.ts
new file mode 100644
index 00000000000..d562745256e
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-share-locations.ts
@@ -0,0 +1,33 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { groupRefListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectShareLocationsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_share_locations',
+ displayName: 'List Project Share Locations',
+ description: 'Lists the groups a project can be shared with.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the groups the connected user may share a GitLab project with. Returns one page plus nextPage/hasMore. Use to find a group ID for Share Project With Group.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: groupRefListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/share_locations`,
+ query: { search: optionalText(propsValue.search) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-transfer-locations.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-transfer-locations.ts
new file mode 100644
index 00000000000..ed28c282716
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-transfer-locations.ts
@@ -0,0 +1,33 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { groupRefListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectTransferLocationsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_transfer_locations',
+ displayName: 'List Project Transfer Locations',
+ description: 'Lists the groups a project can be moved to.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the groups the connected user may transfer (move) a GitLab project to. Read-only; it does not move anything. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: groupRefListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/transfer_locations`,
+ query: { search: optionalText(propsValue.search) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-users.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-users.ts
new file mode 100644
index 00000000000..74d71b4899b
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-project-users.ts
@@ -0,0 +1,33 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput } from '../../common/props';
+import { projectUserListOutputSchema } from '../../output-schemas-admin';
+
+export const listProjectUsersAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_users',
+ displayName: 'List Project Users',
+ description: 'Lists the users who can be mentioned or assigned in a project.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the users of a GitLab project (everyone who can be assigned or mentioned there), with optional name or username search, without roles. Returns one page plus nextPage/hasMore. Use List Project Members to see access levels.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ search: adminProps.search('Matches name and username.'),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: projectUserListOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabListPage({ auth,
+ path: `${projectPath(propsValue.projectId)}/users`,
+ query: { search: optionalText(propsValue.search) },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-projects.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-projects.ts
new file mode 100644
index 00000000000..8389a49f4b6
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-projects.ts
@@ -0,0 +1,69 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, triStateValue } from '../../common/props';
+import { projectListOutputSchema } from '../../output-schemas-admin';
+
+export const projectOrderBy = () =>
+ Property.StaticDropdown({
+ displayName: 'Order By',
+ required: false,
+ options: {
+ options: [
+ { label: 'Created At', value: 'created_at' },
+ { label: 'Last Activity', value: 'last_activity_at' },
+ { label: 'Name', value: 'name' },
+ { label: 'Path', value: 'path' },
+ { label: 'Updated At', value: 'updated_at' },
+ { label: 'ID', value: 'id' },
+ ],
+ },
+ });
+
+export const listProjectsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_projects',
+ displayName: 'List Projects',
+ description: 'Lists projects you are a member of, one page at a time.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists GitLab projects the connected user is a member of (Member Only defaults to yes), with optional name search, owned-only, archived and visibility filters. Member Only can be set to no only together with Search or Owned Only, because gitlab.com would otherwise return every public project. Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ search: adminProps.search('Matches project name and path.'),
+ membership: gitlabProps.triState('Member Only', 'Defaults to yes. Set to no only together with Search or Owned Only.'),
+ owned: gitlabProps.triState('Owned Only', 'Only projects owned by the connected user.'),
+ archived: gitlabProps.triState('Archived', 'Yes = only archived, No = only active, empty = both.'),
+ visibility: adminProps.visibility('Only projects with this visibility.'),
+ orderBy: projectOrderBy(),
+ sort: gitlabProps.sort(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: projectListOutputSchema,
+ async run({ auth, propsValue }) {
+ const search = optionalText(propsValue.search);
+ const owned = triStateValue(propsValue.owned);
+ const membership = triStateValue(propsValue.membership) ?? true;
+ if (!membership && search === undefined && owned !== true) {
+ throw new Error('Member Only can be turned off only together with Search or Owned Only; otherwise gitlab.com returns every public project.');
+ }
+ return gitlabListPage({ auth,
+ path: '/projects',
+ query: {
+ membership: membership ? true : undefined,
+ search,
+ owned,
+ archived: triStateValue(propsValue.archived),
+ visibility: propsValue.visibility,
+ order_by: propsValue.orderBy,
+ sort: propsValue.sort,
+ simple: true,
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/list-user-projects.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/list-user-projects.ts
new file mode 100644
index 00000000000..b6a53125cb2
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/list-user-projects.ts
@@ -0,0 +1,46 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabListPage } from '../../common/client';
+import { gitlabProps, optionalText, pagingInput, requirePositiveInt, triStateValue } from '../../common/props';
+import { projectListOutputSchema } from '../../output-schemas-admin';
+import { projectOrderBy } from './list-projects';
+
+export const listUserProjectsAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_user_projects',
+ displayName: 'List User Projects',
+ description: 'Lists the projects owned by a user that you can see.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists GitLab projects in a given user personal namespace that the connected user can see, with optional search, archived and visibility filters. Takes a numeric user ID (find it with List Users). Returns one page plus nextPage/hasMore.',
+ idempotent: true,
+ },
+ props: {
+ userId: adminProps.userId(),
+ search: adminProps.search('Matches project name and path.'),
+ archived: gitlabProps.triState('Archived', 'Yes = only archived, No = only active, empty = both.'),
+ visibility: adminProps.visibility('Only projects with this visibility.'),
+ orderBy: projectOrderBy(),
+ sort: gitlabProps.sort(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: projectListOutputSchema,
+ async run({ auth, propsValue }) {
+ const userId = requirePositiveInt({ value: propsValue.userId, label: 'User ID' });
+ return gitlabListPage({ auth,
+ path: `/users/${userId}/projects`,
+ query: {
+ search: optionalText(propsValue.search),
+ archived: triStateValue(propsValue.archived),
+ visibility: propsValue.visibility,
+ order_by: propsValue.orderBy,
+ sort: propsValue.sort,
+ simple: true,
+ },
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/share-project-with-group.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/share-project-with-group.ts
new file mode 100644
index 00000000000..18149e9c678
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/share-project-with-group.ts
@@ -0,0 +1,38 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps, optionalDay, requireAccessLevel } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { projectShareOutputSchema } from '../../output-schemas-admin';
+
+export const shareProjectWithGroupAction = createAction({
+ auth: gitlabAuth,
+ name: 'share_project_with_group',
+ displayName: 'Share Project With Group',
+ description: 'Gives every member of a group access to a project.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Shares a GitLab project with a group so its members get the chosen access level, optionally until an expiry date. Find candidate groups with List Project Share Locations. Sharing with a group that already has access fails with 409.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ groupId: Property.Number({ displayName: 'Group ID', description: 'Numeric ID of the group to share with.', required: true }),
+ groupAccess: adminProps.accessLevel('Access Level', true, 'Role the group members get in the project.'),
+ expiresAt: Property.ShortText({ displayName: 'Expires At', description: 'YYYY-MM-DD. Empty = no expiry.', required: false }),
+ },
+ outputSchema: projectShareOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/share`,
+ body: {
+ group_id: requirePositiveInt({ value: propsValue.groupId, label: 'Group ID' }),
+ group_access: requireAccessLevel({ value: propsValue.groupAccess, label: 'Access Level' }),
+ expires_at: optionalDay({ value: propsValue.expiresAt, label: 'Expires At' }),
+ },
+ statusMessages: { 409: 'The project is already shared with this group' },
+ });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/star-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/star-project.ts
new file mode 100644
index 00000000000..eee8c9cf681
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/star-project.ts
@@ -0,0 +1,50 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { GitlabAuthValue, gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps } from '../../common/props';
+import { GitlabApiError } from '../../common/secret-request';
+import { projectStarOutputSchema } from '../../output-schemas-admin';
+
+type StarredProject = { id: number; path_with_namespace: string; star_count: number };
+
+export async function toggleStar({ auth, projectId, verb }: { auth: GitlabAuthValue; projectId: string; verb: 'star' | 'unstar' }) {
+ const path = projectPath(projectId);
+ let project: StarredProject;
+ let unchanged = false;
+ try {
+ project = await gitlabRequest<StarredProject>({ auth, method: 'POST', path: `${path}/${verb}` });
+ } catch (error) {
+ if (!(error instanceof GitlabApiError) || error.status !== 304) {
+ throw error;
+ }
+ unchanged = true;
+ project = await gitlabRequest<StarredProject>({ auth, method: 'GET', path });
+ }
+ return {
+ starred: verb === 'star',
+ unchanged,
+ projectId: project.id,
+ path_with_namespace: project.path_with_namespace,
+ star_count: project.star_count,
+ };
+}
+
+export const starProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'star_project',
+ displayName: 'Star Project',
+ description: 'Stars a project for the connected user.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Stars a GitLab project for the connected user. If it is already starred the call succeeds with unchanged true. Undo with Unstar Project.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectStarOutputSchema,
+ async run({ auth, propsValue }) {
+ return toggleStar({ auth, projectId: propsValue.projectId, verb: 'star' });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/unarchive-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/unarchive-project.ts
new file mode 100644
index 00000000000..168059e8951
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/unarchive-project.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps } from '../../common/props';
+import { projectOutputSchema } from '../../output-schemas-admin';
+
+export const unarchiveProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'unarchive_project',
+ displayName: 'Unarchive Project',
+ description: 'Unarchives a project so it can be changed again.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Unarchives an archived GitLab project so pushes, issues, merge requests and pipelines work again. Requires Maintainer or Owner role. Unarchiving an active project changes nothing. Reverses Archive Project.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectOutputSchema,
+ async run({ auth, propsValue }) {
+ return gitlabRequest({ auth, method: 'POST', path: `${projectPath(propsValue.projectId)}/unarchive` });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/projects/unstar-project.ts b/packages/pieces/community/gitlab/src/lib/actions/projects/unstar-project.ts
new file mode 100644
index 00000000000..152aab44dae
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/projects/unstar-project.ts
@@ -0,0 +1,25 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabProps } from '../../common/props';
+import { projectStarOutputSchema } from '../../output-schemas-admin';
+import { toggleStar } from './star-project';
+
+export const unstarProjectAction = createAction({
+ auth: gitlabAuth,
+ name: 'unstar_project',
+ displayName: 'Unstar Project',
+ description: 'Removes the connected user star from a project.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Removes the connected user star from a GitLab project. If it is not starred the call succeeds with unchanged true. Reverses Star Project.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ },
+ outputSchema: projectStarOutputSchema,
+ async run({ auth, propsValue }) {
+ return toggleStar({ auth, projectId: propsValue.projectId, verb: 'unstar' });
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/repository/get-file.ts b/packages/pieces/community/gitlab/src/lib/actions/repository/get-file.ts
index 30b9ac6647c..3f26dcb42cc 100644
--- a/packages/pieces/community/gitlab/src/lib/actions/repository/get-file.ts
+++ b/packages/pieces/community/gitlab/src/lib/actions/repository/get-file.ts
@@ -8,8 +8,6 @@ import {
import { gitlabProps, requireText } from '../../common/props';
import { fileOutputSchema } from '../../output-schemas';
-export const MAX_FILE_TEXT_BYTES = 1_000_000;
-
const UTF8_MAX_CHAR_BYTES = 4;
export function decodeFilePrefix({
@@ -115,3 +113,5 @@ export const getFileAction = createAction({
};
},
});
+
+export const MAX_FILE_TEXT_BYTES = 1_000_000;
diff --git a/packages/pieces/community/gitlab/src/lib/actions/webhooks/create-project-webhook.ts b/packages/pieces/community/gitlab/src/lib/actions/webhooks/create-project-webhook.ts
new file mode 100644
index 00000000000..7d133d4b4ac
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/webhooks/create-project-webhook.ts
@@ -0,0 +1,111 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, optionalText, requireText, triStateValue } from '../../common/props';
+import { isRecord } from '../../common/secret-request';
+import { hookOutputSchema } from '../../output-schemas-admin';
+
+export function hookEventProps(description: string) {
+ return {
+ pushEvents: gitlabProps.triState('Push Events', description),
+ tagPushEvents: gitlabProps.triState('Tag Push Events', description),
+ issuesEvents: gitlabProps.triState('Issue Events', description),
+ confidentialIssuesEvents: gitlabProps.triState('Confidential Issue Events', description),
+ mergeRequestsEvents: gitlabProps.triState('Merge Request Events', description),
+ noteEvents: gitlabProps.triState('Comment Events', description),
+ pipelineEvents: gitlabProps.triState('Pipeline Events', description),
+ jobEvents: gitlabProps.triState('Job Events', description),
+ releasesEvents: gitlabProps.triState('Release Events', description),
+ wikiPageEvents: gitlabProps.triState('Wiki Page Events', description),
+ };
+}
+
+export function requireHookUrl(value: unknown): string {
+ const text = requireText({ value: value, label: 'URL' });
+ let url: URL;
+ try {
+ url = new URL(text);
+ } catch {
+ throw new Error('URL must be a full http or https address.');
+ }
+ if (url.protocol !== 'https:' && url.protocol !== 'http:') {
+ throw new Error('URL must start with http:// or https://.');
+ }
+ return text;
+}
+
+export function hookBody(propsValue: Record<string, unknown>): Record<string, unknown> {
+ const body: Record<string, unknown> = {};
+ for (const event of HOOK_EVENTS) {
+ const value = triStateValue(propsValue[event.prop]);
+ if (value !== undefined) body[event.key] = value;
+ }
+ const name = optionalText(propsValue['name']);
+ if (name !== undefined) body['name'] = name;
+ const description = optionalText(propsValue['description']);
+ if (description !== undefined) body['description'] = description;
+ if (typeof propsValue['pushEventsBranchFilter'] === 'string' && propsValue['pushEventsBranchFilter'].trim() !== '') {
+ body['push_events_branch_filter'] = propsValue['pushEventsBranchFilter'].trim();
+ }
+ const ssl = triStateValue(propsValue['enableSslVerification']);
+ if (ssl !== undefined) body['enable_ssl_verification'] = ssl;
+ return body;
+}
+
+export function withoutToken(hook: unknown): unknown {
+ if (!isRecord(hook)) {
+ return hook;
+ }
+ return Object.fromEntries(Object.entries(hook).filter(([key]) => key !== 'token'));
+}
+
+export function hookCommonProps() {
+ return {
+ name: Property.ShortText({ displayName: 'Name', required: false }),
+ description: Property.LongText({ displayName: 'Description', required: false }),
+ pushEventsBranchFilter: Property.ShortText({ displayName: 'Push Branch Filter', description: 'Only push events for branches matching this wildcard, e.g. main or release/*.', required: false }),
+ enableSslVerification: gitlabProps.triState('SSL Verification', 'Leave empty for the GitLab default (yes).'),
+ };
+}
+
+export const createProjectWebhookAction = createAction({
+ auth: gitlabAuth,
+ name: 'create_project_webhook',
+ displayName: 'Create Project Webhook',
+ description: 'Adds a webhook to a project that calls a URL on the chosen events.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Adds a webhook to a GitLab project that POSTs to a URL on the events set to yes (push events default to yes in GitLab, the rest to no). No secret token is set here so it never lands in run history; add one in GitLab if the receiver needs it. Each call adds another webhook, even for the same URL; check List Project Webhooks first. Requires Maintainer role.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ url: Property.ShortText({ displayName: 'URL', description: 'Address GitLab will POST events to.', required: true }),
+ ...hookCommonProps(),
+ ...hookEventProps('Leave empty for the GitLab default.'),
+ },
+ outputSchema: hookOutputSchema,
+ async run({ auth, propsValue }) {
+ const url = requireHookUrl(propsValue.url);
+ const hook = await gitlabRequest({ auth,
+ method: 'POST',
+ path: `${projectPath(propsValue.projectId)}/hooks`,
+ body: { url, ...hookBody(propsValue) },
+ });
+ return withoutToken(hook);
+ },
+});
+
+export const HOOK_EVENTS = [
+ { prop: 'pushEvents', key: 'push_events', label: 'Push Events' },
+ { prop: 'tagPushEvents', key: 'tag_push_events', label: 'Tag Push Events' },
+ { prop: 'issuesEvents', key: 'issues_events', label: 'Issue Events' },
+ { prop: 'confidentialIssuesEvents', key: 'confidential_issues_events', label: 'Confidential Issue Events' },
+ { prop: 'mergeRequestsEvents', key: 'merge_requests_events', label: 'Merge Request Events' },
+ { prop: 'noteEvents', key: 'note_events', label: 'Comment Events' },
+ { prop: 'pipelineEvents', key: 'pipeline_events', label: 'Pipeline Events' },
+ { prop: 'jobEvents', key: 'job_events', label: 'Job Events' },
+ { prop: 'releasesEvents', key: 'releases_events', label: 'Release Events' },
+ { prop: 'wikiPageEvents', key: 'wiki_page_events', label: 'Wiki Page Events' },
+] as const;
diff --git a/packages/pieces/community/gitlab/src/lib/actions/webhooks/delete-project-webhook.ts b/packages/pieces/community/gitlab/src/lib/actions/webhooks/delete-project-webhook.ts
new file mode 100644
index 00000000000..5fcd9efdc8d
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/webhooks/delete-project-webhook.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { deletedHookOutputSchema } from '../../output-schemas-admin';
+
+export const deleteProjectWebhookAction = createAction({
+ auth: gitlabAuth,
+ name: 'delete_project_webhook',
+ displayName: 'Delete Project Webhook',
+ description: 'Permanently deletes a project webhook.',
+ audience: 'ai',
+ classification: 'DESTRUCTIVE',
+ aiMetadata: {
+ description: 'Permanently deletes a GitLab project webhook so its URL stops receiving events; it cannot be restored. Deleting a webhook created by an Activepieces trigger breaks that trigger until it is re-enabled, so check the URL with Get Project Webhook first. A second call fails with not found. Requires Maintainer role.',
+ idempotent: false,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ hookId: adminProps.hookId(),
+ },
+ outputSchema: deletedHookOutputSchema,
+ async run({ auth, propsValue }) {
+ const hookId = requirePositiveInt({ value: propsValue.hookId, label: 'Webhook ID' });
+ await gitlabRequest({ auth, method: 'DELETE', path: `${projectPath(propsValue.projectId)}/hooks/${hookId}` });
+ return { deleted: true, hookId };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/webhooks/get-project-webhook.ts b/packages/pieces/community/gitlab/src/lib/actions/webhooks/get-project-webhook.ts
new file mode 100644
index 00000000000..49dfa66d677
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/webhooks/get-project-webhook.ts
@@ -0,0 +1,29 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { hookOutputSchema } from '../../output-schemas-admin';
+import { withoutToken } from './create-project-webhook';
+
+export const getProjectWebhookAction = createAction({
+ auth: gitlabAuth,
+ name: 'get_project_webhook',
+ displayName: 'Get Project Webhook',
+ description: 'Gets one project webhook with its URL and events.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns one GitLab project webhook by numeric ID: URL, name, which events it fires on, branch filter and SSL verification. The secret token is never returned. Requires Maintainer role.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ hookId: adminProps.hookId(),
+ },
+ outputSchema: hookOutputSchema,
+ async run({ auth, propsValue }) {
+ const hookId = requirePositiveInt({ value: propsValue.hookId, label: 'Webhook ID' });
+ return withoutToken(await gitlabRequest({ auth, method: 'GET', path: `${projectPath(propsValue.projectId)}/hooks/${hookId}` }));
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/webhooks/list-project-webhooks.ts b/packages/pieces/community/gitlab/src/lib/actions/webhooks/list-project-webhooks.ts
new file mode 100644
index 00000000000..f65f1285498
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/webhooks/list-project-webhooks.ts
@@ -0,0 +1,32 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { gitlabListPage, projectPath } from '../../common/client';
+import { gitlabProps, pagingInput } from '../../common/props';
+import { hookListOutputSchema } from '../../output-schemas-admin';
+import { withoutToken } from './create-project-webhook';
+
+export const listProjectWebhooksAction = createAction({
+ auth: gitlabAuth,
+ name: 'list_project_webhooks',
+ displayName: 'List Project Webhooks',
+ description: 'Lists the webhooks of a project.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the webhooks of a GitLab project with their URL and enabled events (secret tokens are never returned), including the ones Activepieces triggers created. Returns one page plus nextPage/hasMore. Requires Maintainer role.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ page: gitlabProps.page(),
+ perPage: gitlabProps.perPage(),
+ },
+ outputSchema: hookListOutputSchema,
+ async run({ auth, propsValue }) {
+ const result = await gitlabListPage<unknown>({ auth,
+ path: `${projectPath(propsValue.projectId)}/hooks`,
+ ...pagingInput({ page: propsValue.page, perPage: propsValue.perPage }),
+ });
+ return { ...result, items: result.items.map((hook) => withoutToken(hook)) };
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/actions/webhooks/update-project-webhook.ts b/packages/pieces/community/gitlab/src/lib/actions/webhooks/update-project-webhook.ts
new file mode 100644
index 00000000000..553b10a7c18
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/actions/webhooks/update-project-webhook.ts
@@ -0,0 +1,57 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { gitlabAuth } from '../../auth';
+import { adminProps } from '../../common/admin';
+import { gitlabRequest, projectPath } from '../../common/client';
+import { gitlabProps, requirePositiveInt } from '../../common/props';
+import { hookOutputSchema } from '../../output-schemas-admin';
+import { hookBody, hookCommonProps, hookEventProps, requireHookUrl, withoutToken } from './create-project-webhook';
+
+const CLEARABLE_FIELDS = ['description', 'push_events_branch_filter'];
+
+export const updateProjectWebhookAction = createAction({
+ auth: gitlabAuth,
+ name: 'update_project_webhook',
+ displayName: 'Update Project Webhook',
+ description: 'Changes the URL, events or settings of a project webhook. Fields left empty are not changed.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Changes a GitLab project webhook: URL, name, description, branch filter, SSL verification and which events fire it. URL is required (GitLab needs it on every update; pass the current one to keep it). Only the other fields you set are sent; use Clear Fields to remove a description or branch filter. The secret token is not managed here. Changing a webhook created by an Activepieces trigger can stop that trigger. Requires Maintainer role.',
+ idempotent: true,
+ },
+ props: {
+ projectId: gitlabProps.projectId(),
+ hookId: adminProps.hookId(),
+ url: Property.ShortText({ displayName: 'URL', description: 'Address GitLab will POST events to. Enter the current URL to keep it.', required: true }),
+ ...hookCommonProps(),
+ clearFields: Property.StaticMultiSelectDropdown({
+ displayName: 'Clear Fields',
+ description: 'Settings to remove from the webhook.',
+ required: false,
+ options: {
+ options: [
+ { label: 'Description', value: 'description' },
+ { label: 'Push Branch Filter', value: 'push_events_branch_filter' },
+ ],
+ },
+ }),
+ ...hookEventProps('Leave empty to keep the current value.'),
+ },
+ outputSchema: hookOutputSchema,
+ async run({ auth, propsValue }) {
+ const hookId = requirePositiveInt({ value: propsValue.hookId, label: 'Webhook ID' });
+ const path = `${projectPath(propsValue.projectId)}/hooks/${hookId}`;
+ const url = requireHookUrl(propsValue.url);
+ const changes = hookBody(propsValue);
+ for (const field of propsValue.clearFields ?? []) {
+ if (!CLEARABLE_FIELDS.includes(field)) {
+ throw new Error(`Unknown field to clear: ${field}.`);
+ }
+ if (field in changes) {
+ throw new Error('A field cannot be both set and cleared.');
+ }
+ changes[field] = '';
+ }
+ return withoutToken(await gitlabRequest({ auth, method: 'PUT', path, body: { url, ...changes } }));
+ },
+});
diff --git a/packages/pieces/community/gitlab/src/lib/common/admin.ts b/packages/pieces/community/gitlab/src/lib/common/admin.ts
new file mode 100644
index 00000000000..f10eba60d93
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/common/admin.ts
@@ -0,0 +1,96 @@
+import { Property } from '@activepieces/pieces-framework';
+import { encodeSegment } from './client';
+import { requirePositiveInt } from './props';
+
+export function groupPath(groupId: string | number): string {
+ return `/groups/${encodeSegment({ value: groupId, label: 'Group ID or path' })}`;
+}
+
+export function requireAccessLevel({ value, label }: { value: unknown; label: string }): number {
+ const level = requirePositiveInt({ value: value, label: label });
+ if (!ACCESS_LEVELS.some((item) => item.value === level)) {
+ throw new Error(`${label} must be one of ${ACCESS_LEVELS.map((item) => item.value).join(', ')}.`);
+ }
+ return level;
+}
+
+export function optionalAccessLevel({ value, label }: { value: unknown; label: string }): number | undefined {
+ if (value === undefined || value === null || value === '') {
+ return undefined;
+ }
+ return requireAccessLevel({ value: value, label: label });
+}
+
+export function requireColor({ value, label }: { value: unknown; label: string }): string {
+ if (typeof value !== 'string' || value.trim().length === 0) {
+ throw new Error(`${label} is required.`);
+ }
+ const color = value.trim();
+ if (!/^#[0-9a-fA-F]{6}$/.test(color) && !/^#[0-9a-fA-F]{3}$/.test(color) && !/^[a-zA-Z]{3,30}$/.test(color)) {
+ throw new Error(`${label} must be a hex color such as #FF0000 or a CSS color name.`);
+ }
+ return color;
+}
+
+export function optionalDay({ value, label }: { value: unknown; label: string }): string | undefined {
+ if (value === undefined || value === null) {
+ return undefined;
+ }
+ if (typeof value !== 'string') {
+ throw new Error(`${label} must be a date in YYYY-MM-DD format.`);
+ }
+ const text = value.trim();
+ if (text.length === 0) {
+ return undefined;
+ }
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(text) || Number.isNaN(Date.parse(text))) {
+ throw new Error(`${label} must be a date in YYYY-MM-DD format.`);
+ }
+ return text;
+}
+
+export const ACCESS_LEVELS = [
+ { label: 'Guest', value: 10 },
+ { label: 'Planner', value: 15 },
+ { label: 'Reporter', value: 20 },
+ { label: 'Developer', value: 30 },
+ { label: 'Maintainer', value: 40 },
+ { label: 'Owner', value: 50 },
+];
+
+export const adminProps = {
+ groupId: (description = 'Numeric group ID or full path, e.g. `my-group/sub-group`.') =>
+ Property.ShortText({ displayName: 'Group ID or Path', description, required: true }),
+ userId: (description = 'Numeric GitLab user ID. Find it with List Users.') =>
+ Property.Number({ displayName: 'User ID', description, required: true }),
+ pipelineId: () =>
+ Property.Number({ displayName: 'Pipeline ID', description: 'Numeric pipeline ID (not the pipeline IID). Find it with List Pipelines.', required: true }),
+ jobId: () =>
+ Property.Number({ displayName: 'Job ID', description: 'Numeric job ID. Find it with List Pipeline Jobs.', required: true }),
+ hookId: () =>
+ Property.Number({ displayName: 'Webhook ID', description: 'Numeric webhook ID. Find it with List Project Webhooks.', required: true }),
+ milestoneId: () =>
+ Property.Number({
+ displayName: 'Milestone ID',
+ description: 'The global milestone `id` (not the `iid` shown in the GitLab UI). Find it with List Milestones.',
+ required: true,
+ }),
+ labelId: () =>
+ Property.ShortText({ displayName: 'Label ID or Name', description: 'Numeric label ID or the exact label name.', required: true }),
+ visibility: (description: string) =>
+ Property.StaticDropdown<string>({
+ displayName: 'Visibility',
+ description,
+ required: false,
+ options: {
+ options: [
+ { label: 'Private', value: 'private' },
+ { label: 'Internal', value: 'internal' },
+ { label: 'Public', value: 'public' },
+ ],
+ },
+ }),
+ accessLevel: (displayName: string, required: boolean, description: string) =>
+ Property.StaticDropdown<number>({ displayName, description, required, options: { options: ACCESS_LEVELS } }),
+ search: (description = 'Text to match against names.') => Property.ShortText({ displayName: 'Search', description, required: false }),
+};
diff --git a/packages/pieces/community/gitlab/src/lib/common/client.ts b/packages/pieces/community/gitlab/src/lib/common/client.ts
index f98a5035666..ca18c6f53d8 100644
--- a/packages/pieces/community/gitlab/src/lib/common/client.ts
+++ b/packages/pieces/community/gitlab/src/lib/common/client.ts
@@ -6,19 +6,6 @@ import {
sendGitlabRequest,
} from './secret-request';
-export type GitlabAuthValue = OAuth2PropertyValue;
-
-export type GitlabCall = Omit<GitlabRequest, 'token'>;
-
-export type GitlabPage<T> = {
- items: T[];
- count: number;
- page: number;
- nextPage: number | null;
- hasMore: boolean;
- total: number | null;
-};
-
export function gitlabToken(auth: GitlabAuthValue): string {
return getAccessTokenOrThrow(auth);
}
@@ -120,3 +107,16 @@ export async function gitlabListPage<T>({
total: headerInt({ headers: response.headers, name: 'x-total' }),
};
}
+
+export type GitlabAuthValue = OAuth2PropertyValue;
+
+export type GitlabCall = Omit<GitlabRequest, 'token'>;
+
+export type GitlabPage<T> = {
+ items: T[];
+ count: number;
+ page: number;
+ nextPage: number | null;
+ hasMore: boolean;
+ total: number | null;
+};
diff --git a/packages/pieces/community/gitlab/src/lib/common/index.ts b/packages/pieces/community/gitlab/src/lib/common/index.ts
index 3b5094575f6..31f34ba4653 100644
--- a/packages/pieces/community/gitlab/src/lib/common/index.ts
+++ b/packages/pieces/community/gitlab/src/lib/common/index.ts
@@ -3,8 +3,6 @@ import { gitlabAuth } from '../auth';
import { GitlabAuthValue, gitlabListPage } from './client';
import { GitlabProjectSummary } from './models';
-export const PROJECT_DROPDOWN_PAGE_CAP = 10;
-
export async function listProjectOptions({
auth,
searchValue,
@@ -46,6 +44,8 @@ export async function listProjectOptions({
return { options, truncated: page !== null };
}
+export const PROJECT_DROPDOWN_PAGE_CAP = 10;
+
export const gitlabCommon = {
projectId: (required = true) =>
Property.Dropdown({
diff --git a/packages/pieces/community/gitlab/src/lib/common/irreversible.ts b/packages/pieces/community/gitlab/src/lib/common/irreversible.ts
index 52fe42189b5..64457eabfcd 100644
--- a/packages/pieces/community/gitlab/src/lib/common/irreversible.ts
+++ b/packages/pieces/community/gitlab/src/lib/common/irreversible.ts
@@ -1,4 +1,5 @@
import { GitlabAuthValue, gitlabRequest, projectPath } from './client';
+import { GitlabApiError } from './secret-request';
export async function resetIssueSpentTime<T>({
auth,
@@ -37,3 +38,32 @@ export async function mergeMergeRequest<T>({
statusMessages,
});
}
+
+export async function cancelJob<T>({ auth, projectId, jobId }: { auth: GitlabAuthValue; projectId: string | number; jobId: number }): Promise<T> {
+ return gitlabRequest<T>({ auth, method: 'POST', path: `${projectPath(projectId)}/jobs/${jobId}/cancel` });
+}
+
+export async function cancelPipeline<T>({ auth, projectId, pipelineId }: { auth: GitlabAuthValue; projectId: string | number; pipelineId: number }): Promise<T> {
+ return gitlabRequest<T>({ auth, method: 'POST', path: `${projectPath(projectId)}/pipelines/${pipelineId}/cancel` });
+}
+
+export async function eraseJob<T>({ auth, projectId, jobId }: { auth: GitlabAuthValue; projectId: string | number; jobId: number }): Promise<T> {
+ return gitlabRequest<T>({
+ auth,
+ method: 'POST',
+ path: `${projectPath(projectId)}/jobs/${jobId}/erase`,
+ statusMessages: { 403: 'GitLab refused to erase the job (it may still be running, already erased, or the connected user lacks permission)' },
+ });
+}
+
+export async function archiveProject<T>({ auth, projectId }: { auth: GitlabAuthValue; projectId: string | number }): Promise<T> {
+ const path = projectPath(projectId);
+ try {
+ return await gitlabRequest<T>({ auth, method: 'POST', path: `${path}/archive` });
+ } catch (error) {
+ if (error instanceof GitlabApiError && error.status === 400 && /already archived/i.test(error.message)) {
+ return gitlabRequest<T>({ auth, method: 'GET', path });
+ }
+ throw error;
+ }
+}
diff --git a/packages/pieces/community/gitlab/src/lib/common/props.ts b/packages/pieces/community/gitlab/src/lib/common/props.ts
index 12b4765a98b..938b0df11cb 100644
--- a/packages/pieces/community/gitlab/src/lib/common/props.ts
+++ b/packages/pieces/community/gitlab/src/lib/common/props.ts
@@ -1,81 +1,5 @@
import { Property } from '@activepieces/pieces-framework';
-export const gitlabProps = {
- projectId: (
- description = 'Numeric project ID or full path, e.g. `my-group/my-project`. Shown on the project overview page.'
- ) =>
- Property.ShortText({
- displayName: 'Project ID or Path',
- description,
- required: true,
- }),
- issueIid: () =>
- Property.Number({
- displayName: 'Issue IID',
- description:
- 'The issue number inside the project (the `iid`, shown as #12 in GitLab), not the global issue ID.',
- required: true,
- }),
- mergeRequestIid: () =>
- Property.Number({
- displayName: 'Merge Request IID',
- description:
- 'The merge request number inside the project (the `iid`, shown as !12 in GitLab), not the global ID.',
- required: true,
- }),
- noteId: () =>
- Property.Number({
- displayName: 'Note ID',
- description: 'Numeric ID of the comment (note).',
- required: true,
- }),
- sha: (displayName = 'Commit SHA') =>
- Property.ShortText({
- displayName,
- description:
- 'Commit SHA, or a branch or tag name that resolves to a commit.',
- required: true,
- }),
- branch: (displayName = 'Branch', description = 'Branch name.') =>
- Property.ShortText({ displayName, description, required: true }),
- page: () =>
- Property.Number({
- displayName: 'Page',
- description:
- 'Page number to fetch, starting at 1. Use `nextPage` from the previous result to continue.',
- required: false,
- }),
- perPage: () =>
- Property.Number({
- displayName: 'Per Page',
- description: 'Items per page, 1 to 100. Defaults to 20.',
- required: false,
- }),
- sort: () =>
- Property.StaticDropdown({
- displayName: 'Sort',
- required: false,
- options: {
- options: [
- { label: 'Descending', value: 'desc' },
- { label: 'Ascending', value: 'asc' },
- ],
- },
- }),
- triState: (displayName: string, description: string) =>
- Property.StaticDropdown<string>({
- displayName,
- description,
- required: false,
- options: {
- options: [
- { label: 'Yes', value: 'true' },
- { label: 'No', value: 'false' },
- ],
- },
- }),
-};
-
export function requirePositiveInt({
value,
label,
@@ -215,3 +139,79 @@ export function requireDuration({
}
return compact;
}
+
+export const gitlabProps = {
+ projectId: (
+ description = 'Numeric project ID or full path, e.g. `my-group/my-project`. Shown on the project overview page.'
+ ) =>
+ Property.ShortText({
+ displayName: 'Project ID or Path',
+ description,
+ required: true,
+ }),
+ issueIid: () =>
+ Property.Number({
+ displayName: 'Issue IID',
+ description:
+ 'The issue number inside the project (the `iid`, shown as #12 in GitLab), not the global issue ID.',
+ required: true,
+ }),
+ mergeRequestIid: () =>
+ Property.Number({
+ displayName: 'Merge Request IID',
+ description:
+ 'The merge request number inside the project (the `iid`, shown as !12 in GitLab), not the global ID.',
+ required: true,
+ }),
+ noteId: () =>
+ Property.Number({
+ displayName: 'Note ID',
+ description: 'Numeric ID of the comment (note).',
+ required: true,
+ }),
+ sha: (displayName = 'Commit SHA') =>
+ Property.ShortText({
+ displayName,
+ description:
+ 'Commit SHA, or a branch or tag name that resolves to a commit.',
+ required: true,
+ }),
+ branch: (displayName = 'Branch', description = 'Branch name.') =>
+ Property.ShortText({ displayName, description, required: true }),
+ page: () =>
+ Property.Number({
+ displayName: 'Page',
+ description:
+ 'Page number to fetch, starting at 1. Use `nextPage` from the previous result to continue.',
+ required: false,
+ }),
+ perPage: () =>
+ Property.Number({
+ displayName: 'Per Page',
+ description: 'Items per page, 1 to 100. Defaults to 20.',
+ required: false,
+ }),
+ sort: () =>
+ Property.StaticDropdown({
+ displayName: 'Sort',
+ required: false,
+ options: {
+ options: [
+ { label: 'Descending', value: 'desc' },
+ { label: 'Ascending', value: 'asc' },
+ ],
+ },
+ }),
+ triState: (displayName: string, description: string) =>
+ Property.StaticDropdown<string>({
+ displayName,
+ description,
+ required: false,
+ options: {
+ options: [
+ { label: 'Yes', value: 'true' },
+ { label: 'No', value: 'false' },
+ ],
+ },
+ }),
+};
diff --git a/packages/pieces/community/gitlab/src/lib/common/secret-request.ts b/packages/pieces/community/gitlab/src/lib/common/secret-request.ts
index 990b1bb8092..39b451983fb 100644
--- a/packages/pieces/community/gitlab/src/lib/common/secret-request.ts
+++ b/packages/pieces/community/gitlab/src/lib/common/secret-request.ts
@@ -12,10 +12,6 @@ function getVerifiedTlsAgent(): Promise<Dispatcher> {
return verifiedTlsAgent;
}
-export const gitlabTransport = {
- getDispatcher: getVerifiedTlsAgent,
-};
-
export function isRecord(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === 'object' && !Array.isArray(value);
}
@@ -97,30 +93,6 @@ export function buildGitlabError({
type JsonValue = ReturnType<typeof JSON.parse>;
-export type GitlabQueryValue =
- | string
- | number
- | boolean
- | undefined
- | null
- | Array<string | number>;
-
-export type GitlabRequest = {
- token: string;
- method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE';
- path: string;
- query?: Record<string, GitlabQueryValue>;
- body?: unknown;
- statusMessages?: Partial<Record<number, string>>;
- timeoutMs?: number;
-};
-
-export type GitlabResponse<T> = {
- status: number;
- headers: Headers;
- body: T;
-};
-
export function buildGitlabUrl({
path,
query,
@@ -274,3 +246,31 @@ export async function readGitlabRawPrefix({
}
return { bytes: Buffer.concat(chunks, length), complete };
}
+
+export const gitlabTransport = {
+ getDispatcher: getVerifiedTlsAgent,
+};
+
+export type GitlabQueryValue =
+ | string
+ | number
+ | boolean
+ | undefined
+ | null
+ | Array<string | number>;
+
+export type GitlabRequest = {
+ token: string;
+ method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE';
+ path: string;
+ query?: Record<string, GitlabQueryValue>;
+ body?: unknown;
+ statusMessages?: Partial<Record<number, string>>;
+ timeoutMs?: number;
+};
+
+export type GitlabResponse<T> = {
+ status: number;
+ headers: Headers;
+ body: T;
+};
diff --git a/packages/pieces/community/gitlab/src/lib/output-schemas-admin.ts b/packages/pieces/community/gitlab/src/lib/output-schemas-admin.ts
new file mode 100644
index 00000000000..810d46b0c16
--- /dev/null
+++ b/packages/pieces/community/gitlab/src/lib/output-schemas-admin.ts
@@ -0,0 +1,321 @@
+import { OutputSchema, OutputSchemaField } from '@activepieces/pieces-framework';
+
+type Fields = OutputSchemaField[];
+
+const pageFields = ({ label, itemFields, labelKey }: { label: string; itemFields: Fields; labelKey: string }): Fields => [
+ { key: 'items', label, labelKey, listItems: itemFields },
+ { key: 'count', label: 'Items on This Page', format: 'number' },
+ { key: 'page', label: 'Page', format: 'number' },
+ { key: 'nextPage', label: 'Next Page', format: 'number', description: 'Pass as Page to fetch more. Empty on the last page.' },
+ { key: 'hasMore', label: 'Has More', format: 'boolean' },
+ { key: 'total', label: 'Total', format: 'number', description: 'Total items when GitLab reports it; empty for very large lists.' },
+];
+
+const userRefFields: Fields = [
+ { key: 'id', label: 'User ID', format: 'number' },
+ { key: 'username', label: 'Username' },
+ { key: 'name', label: 'Name' },
+ { key: 'state', label: 'State' },
+ { key: 'avatar_url', label: 'Avatar', format: 'image' },
+ { key: 'web_url', label: 'Profile URL', format: 'url' },
+];
+
+const pipelineFields: Fields = [
+ { key: 'id', label: 'Pipeline ID', format: 'number' },
+ { key: 'iid', label: 'Pipeline IID', format: 'number' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'status', label: 'Status' },
+ { key: 'source', label: 'Source' },
+ { key: 'ref', label: 'Ref' },
+ { key: 'sha', label: 'Commit SHA' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+export const pipelineOutputSchema: OutputSchema = {
+ fields: [
+ ...pipelineFields,
+ { key: 'before_sha', label: 'Before SHA' },
+ { key: 'tag', label: 'Is Tag', format: 'boolean' },
+ { key: 'yaml_errors', label: 'YAML Errors' },
+ { key: 'user', label: 'Triggered By', children: userRefFields },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'finished_at', label: 'Finished At', format: 'datetime' },
+ { key: 'committed_at', label: 'Committed At', format: 'datetime' },
+ { key: 'duration', label: 'Duration (seconds)', format: 'number' },
+ { key: 'queued_duration', label: 'Queued (seconds)', format: 'number' },
+ { key: 'coverage', label: 'Coverage' },
+ { key: 'detailed_status', label: 'Detailed Status', children: [{ key: 'text', label: 'Text' }, { key: 'label', label: 'Label' }, { key: 'group', label: 'Group' }] },
+ ],
+};
+export const pipelineListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Pipelines', itemFields: pipelineFields, labelKey: 'id' }) };
+export const deletedPipelineOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'pipelineId', label: 'Pipeline ID', format: 'number' },
+ ],
+};
+
+const jobFields: Fields = [
+ { key: 'id', label: 'Job ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'stage', label: 'Stage' },
+ { key: 'status', label: 'Status' },
+ { key: 'ref', label: 'Ref' },
+ { key: 'tag', label: 'Is Tag', format: 'boolean' },
+ { key: 'allow_failure', label: 'Allow Failure', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'started_at', label: 'Started At', format: 'datetime' },
+ { key: 'finished_at', label: 'Finished At', format: 'datetime' },
+ { key: 'erased_at', label: 'Erased At', format: 'datetime' },
+ { key: 'duration', label: 'Duration (seconds)', format: 'number' },
+ { key: 'queued_duration', label: 'Queued (seconds)', format: 'number' },
+ { key: 'user', label: 'User', children: userRefFields },
+ { key: 'commit', label: 'Commit', children: [{ key: 'id', label: 'SHA' }, { key: 'short_id', label: 'Short SHA' }, { key: 'title', label: 'Title' }] },
+ { key: 'pipeline', label: 'Pipeline', children: [{ key: 'id', label: 'Pipeline ID', format: 'number' }, { key: 'ref', label: 'Ref' }, { key: 'status', label: 'Status' }] },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+export const jobOutputSchema: OutputSchema = { fields: jobFields };
+export const jobListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Jobs', itemFields: jobFields, labelKey: 'name' }) };
+export const jobLogOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'jobId', label: 'Job ID', format: 'number' },
+ { key: 'log', label: 'Log' },
+ { key: 'truncated', label: 'Truncated', format: 'boolean' },
+ { key: 'totalLength', label: 'Full Log Length (characters)', format: 'number' },
+ ],
+};
+
+const namespaceFields: Fields = [
+ { key: 'id', label: 'Namespace ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'path', label: 'Path' },
+ { key: 'kind', label: 'Kind' },
+ { key: 'full_path', label: 'Full Path' },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+const projectFields: Fields = [
+ { key: 'id', label: 'Project ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'name_with_namespace', label: 'Name With Namespace' },
+ { key: 'path', label: 'Path' },
+ { key: 'path_with_namespace', label: 'Full Path' },
+ { key: 'description', label: 'Description' },
+ { key: 'default_branch', label: 'Default Branch' },
+ { key: 'star_count', label: 'Stars', format: 'number' },
+ { key: 'forks_count', label: 'Forks', format: 'number' },
+ { key: 'topics', label: 'Topics' },
+ { key: 'namespace', label: 'Namespace', children: namespaceFields },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'last_activity_at', label: 'Last Activity', format: 'datetime' },
+ { key: 'http_url_to_repo', label: 'HTTP Clone URL', format: 'url' },
+ { key: 'ssh_url_to_repo', label: 'SSH Clone URL' },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+export const projectOutputSchema: OutputSchema = {
+ fields: [
+ ...projectFields,
+ { key: 'visibility', label: 'Visibility' },
+ { key: 'archived', label: 'Archived', format: 'boolean' },
+ { key: 'import_status', label: 'Import Status' },
+ ],
+};
+export const projectListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Projects', itemFields: projectFields, labelKey: 'path_with_namespace' }) };
+export const deletedProjectOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deletionRequested', label: 'Deletion Requested', format: 'boolean' },
+ { key: 'projectId', label: 'Project ID or Path' },
+ { key: 'message', label: 'GitLab Message' },
+ ],
+};
+export const projectStarOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'starred', label: 'Starred', format: 'boolean' },
+ { key: 'unchanged', label: 'Already In This State', format: 'boolean' },
+ { key: 'projectId', label: 'Project ID', format: 'number' },
+ { key: 'path_with_namespace', label: 'Full Path' },
+ { key: 'star_count', label: 'Stars', format: 'number' },
+ ],
+};
+export const projectLanguagesOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'languages', label: 'Languages', labelKey: 'language', listItems: [{ key: 'language', label: 'Language' }, { key: 'percentage', label: 'Percentage', format: 'number' }] },
+ { key: 'count', label: 'Language Count', format: 'number' },
+ ],
+};
+
+const groupRefFields: Fields = [
+ { key: 'id', label: 'Group ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'full_name', label: 'Full Name' },
+ { key: 'full_path', label: 'Full Path' },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+const groupFields: Fields = [
+ ...groupRefFields,
+ { key: 'path', label: 'Path' },
+ { key: 'description', label: 'Description' },
+ { key: 'visibility', label: 'Visibility' },
+ { key: 'parent_id', label: 'Parent Group ID', format: 'number' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+export const groupOutputSchema: OutputSchema = { fields: groupFields };
+export const groupListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Groups', itemFields: groupFields, labelKey: 'full_path' }) };
+export const groupRefListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Groups', itemFields: groupRefFields, labelKey: 'full_path' }) };
+export const deletedGroupOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deletionRequested', label: 'Deletion Requested', format: 'boolean' },
+ { key: 'groupId', label: 'Group ID or Path' },
+ { key: 'message', label: 'GitLab Message' },
+ ],
+};
+export const projectShareOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'Link ID', format: 'number' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'group_id', label: 'Group ID', format: 'number' },
+ { key: 'group_access', label: 'Access Level', format: 'number' },
+ { key: 'expires_at', label: 'Expires At', format: 'date' },
+ ],
+};
+export const importMembersOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'Status' },
+ { key: 'sourceProjectId', label: 'Source Project ID', format: 'number' },
+ { key: 'errors', label: 'Per-User Errors', labelKey: 'user', listItems: [{ key: 'user', label: 'User' }, { key: 'message', label: 'Message' }] },
+ ],
+};
+
+const memberFields: Fields = [
+ ...userRefFields,
+ { key: 'access_level', label: 'Access Level', format: 'number' },
+ { key: 'expires_at', label: 'Expires At', format: 'date' },
+ { key: 'created_at', label: 'Added At', format: 'datetime' },
+ { key: 'membership_state', label: 'Membership State' },
+];
+
+export const memberOutputSchema: OutputSchema = { fields: memberFields };
+export const memberListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Members', itemFields: memberFields, labelKey: 'username' }) };
+export const projectUserListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Users', itemFields: userRefFields, labelKey: 'username' }) };
+export const billableMemberListOutputSchema: OutputSchema = {
+ fields: pageFields({
+ label: 'Billable Members',
+ itemFields: [...userRefFields, { key: 'last_activity_on', label: 'Last Activity', format: 'date' }, { key: 'membership_type', label: 'Membership Type' }, { key: 'removable', label: 'Removable', format: 'boolean' }],
+ labelKey: 'username',
+ }),
+};
+export const pendingMemberListOutputSchema: OutputSchema = {
+ fields: pageFields({
+ label: 'Pending Members',
+ itemFields: [
+ { key: 'id', label: 'Member ID', format: 'number' },
+ { key: 'username', label: 'Username' },
+ { key: 'name', label: 'Name' },
+ { key: 'email', label: 'Invited Email', format: 'email' },
+ { key: 'invited', label: 'Invited', format: 'boolean' },
+ { key: 'approved', label: 'Approved', format: 'boolean' },
+ { key: 'web_url', label: 'Profile URL', format: 'url' },
+ ],
+ labelKey: 'name',
+ }),
+};
+
+const labelFields: Fields = [
+ { key: 'id', label: 'Label ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'color', label: 'Color' },
+ { key: 'text_color', label: 'Text Color' },
+ { key: 'description', label: 'Description' },
+ { key: 'priority', label: 'Priority', format: 'number' },
+ { key: 'is_project_label', label: 'Project Label', format: 'boolean' },
+ { key: 'subscribed', label: 'Subscribed', format: 'boolean' },
+];
+
+export const labelOutputSchema: OutputSchema = { fields: labelFields };
+export const labelListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Labels', itemFields: labelFields, labelKey: 'name' }) };
+export const deletedLabelOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'label', label: 'Label ID or Name' },
+ ],
+};
+
+const milestoneFields: Fields = [
+ { key: 'id', label: 'Milestone ID', format: 'number' },
+ { key: 'iid', label: 'Milestone IID', format: 'number' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'state', label: 'State' },
+ { key: 'start_date', label: 'Start Date', format: 'date' },
+ { key: 'due_date', label: 'Due Date', format: 'date' },
+ { key: 'expired', label: 'Expired', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+ { key: 'updated_at', label: 'Updated At', format: 'datetime' },
+ { key: 'web_url', label: 'URL', format: 'url' },
+];
+
+export const milestoneOutputSchema: OutputSchema = { fields: milestoneFields };
+export const milestoneListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Milestones', itemFields: milestoneFields, labelKey: 'title' }) };
+export const deletedMilestoneOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'milestoneId', label: 'Milestone ID', format: 'number' },
+ ],
+};
+
+const hookFields: Fields = [
+ { key: 'id', label: 'Webhook ID', format: 'number' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'project_id', label: 'Project ID', format: 'number' },
+ { key: 'push_events', label: 'Push Events', format: 'boolean' },
+ { key: 'push_events_branch_filter', label: 'Push Branch Filter' },
+ { key: 'issues_events', label: 'Issue Events', format: 'boolean' },
+ { key: 'confidential_issues_events', label: 'Confidential Issue Events', format: 'boolean' },
+ { key: 'merge_requests_events', label: 'Merge Request Events', format: 'boolean' },
+ { key: 'tag_push_events', label: 'Tag Push Events', format: 'boolean' },
+ { key: 'note_events', label: 'Comment Events', format: 'boolean' },
+ { key: 'job_events', label: 'Job Events', format: 'boolean' },
+ { key: 'pipeline_events', label: 'Pipeline Events', format: 'boolean' },
+ { key: 'wiki_page_events', label: 'Wiki Page Events', format: 'boolean' },
+ { key: 'releases_events', label: 'Release Events', format: 'boolean' },
+ { key: 'enable_ssl_verification', label: 'SSL Verification', format: 'boolean' },
+ { key: 'created_at', label: 'Created At', format: 'datetime' },
+];
+
+export const hookOutputSchema: OutputSchema = { fields: hookFields };
+export const hookListOutputSchema: OutputSchema = { fields: pageFields({ label: 'Webhooks', itemFields: hookFields, labelKey: 'url' }) };
+export const deletedHookOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'deleted', label: 'Deleted', format: 'boolean' },
+ { key: 'hookId', label: 'Webhook ID', format: 'number' },
+ ],
+};
+
+export const approvalStateOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'approval_rules_overwritten', label: 'Rules Overridden On This Merge Request', format: 'boolean' },
+ {
+ key: 'rules',
+ label: 'Approval Rules',
+ labelKey: 'name',
+ listItems: [
+ { key: 'id', label: 'Rule ID', format: 'number' },
+ { key: 'name', label: 'Name' },
+ { key: 'rule_type', label: 'Rule Type' },
+ { key: 'approvals_required', label: 'Approvals Required', format: 'number' },
+ { key: 'approved', label: 'Approved', format: 'boolean' },
+ { key: 'approved_by', label: 'Approved By', labelKey: 'username', listItems: userRefFields },
+ { key: 'eligible_approvers', label: 'Eligible Approvers', labelKey: 'username', listItems: userRefFields },
+ ],
+ },
+ ],
+};
diff --git a/packages/pieces/community/gitlab/src/lib/trigger/issue-event.ts b/packages/pieces/community/gitlab/src/lib/trigger/issue-event.ts
index 5e985dde149..febedcaafe9 100644
--- a/packages/pieces/community/gitlab/src/lib/trigger/issue-event.ts
+++ b/packages/pieces/community/gitlab/src/lib/trigger/issue-event.ts
@@ -15,7 +15,6 @@ import {
import { ProjectWebhook } from '../common/models';
import { issueEventOutputSchema } from '../output-schemas';
-export const ISSUE_TRIGGER_STORE_KEY = 'gitlab_issue_trigger';
const sampleData = {
object_kind: 'issue',
event_type: 'issue',
@@ -284,3 +283,5 @@ interface WebhookInformation {
projectId: number | string;
token?: string;
}
+
+export const ISSUE_TRIGGER_STORE_KEY = 'gitlab_issue_trigger';
diff --git a/packages/pieces/community/gitlab/test/atomics-wave2.test.ts b/packages/pieces/community/gitlab/test/atomics-wave2.test.ts
new file mode 100644
index 00000000000..064b8f6118f
--- /dev/null
+++ b/packages/pieces/community/gitlab/test/atomics-wave2.test.ts
@@ -0,0 +1,212 @@
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { gitlab } from '../src';
+import { createPipelineAction } from '../src/lib/actions/ci/create-pipeline';
+import { getPipelineAction } from '../src/lib/actions/ci/get-pipeline';
+import { getJobLogAction } from '../src/lib/actions/ci/get-job-log';
+import { listPipelineJobsAction } from '../src/lib/actions/ci/list-pipeline-jobs';
+import { createProjectAction } from '../src/lib/actions/projects/create-project';
+import { listProjectsAction } from '../src/lib/actions/projects/list-projects';
+import { archiveProjectAction } from '../src/lib/actions/projects/archive-project';
+import { forkProjectAction } from '../src/lib/actions/projects/fork-project';
+import { starProjectAction } from '../src/lib/actions/projects/star-project';
+import { unstarProjectAction } from '../src/lib/actions/projects/unstar-project';
+import { importProjectMembersAction } from '../src/lib/actions/projects/import-project-members';
+import { shareProjectWithGroupAction } from '../src/lib/actions/projects/share-project-with-group';
+import { updateGroupAction } from '../src/lib/actions/groups/update-group';
+import { createLabelAction } from '../src/lib/actions/labels/create-label';
+import { updateLabelAction } from '../src/lib/actions/labels/update-label';
+import { createMilestoneAction } from '../src/lib/actions/labels/create-milestone';
+import { updateMilestoneAction } from '../src/lib/actions/labels/update-milestone';
+import { createProjectWebhookAction } from '../src/lib/actions/webhooks/create-project-webhook';
+import { updateProjectWebhookAction } from '../src/lib/actions/webhooks/update-project-webhook';
+import { listProjectWebhooksAction } from '../src/lib/actions/webhooks/list-project-webhooks';
+import { getMergeRequestApprovalStateAction } from '../src/lib/actions/merge-requests/get-merge-request-approval-state';
+import { rawPath, runAction, stubGitlab } from './helpers';
+import { wave2Cases } from './wave2-cases';
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+});
+
+const P = { projectId: 'grp/proj' };
+
+describe('wave 2: exact outgoing request per atomic', () => {
+ it.each(wave2Cases)('$name', async (testCase) => {
+ const isList = testCase.query !== undefined && 'per_page' in testCase.query;
+ const reply = testCase.reply === null ? { status: 204 } : { body: testCase.reply ?? (isList ? [] : { id: 1 }) };
+ const seen = stubGitlab([reply]);
+ const result = await runAction({ action: testCase.action, propsValue: testCase.props });
+ expect(seen).toHaveLength(1);
+ expect(seen[0].method).toBe(testCase.method);
+ expect(rawPath(seen[0])).toBe(testCase.path);
+ expect(seen[0].query).toEqual(testCase.query ?? {});
+ expect(seen[0].body).toEqual(testCase.body);
+ if (testCase.result !== undefined) {
+ expect(result).toEqual(testCase.result);
+ }
+ });
+
+ it('registers all 58 wave-2 actions', () => {
+ const names = new Set(wave2Cases.map((c) => c.action.name));
+ expect(names.size).toBe(58);
+ const registered = Object.keys(gitlab.actions());
+ expect([...names].filter((name) => !registered.includes(name))).toEqual([]);
+ });
+});
+
+describe('wave 2: metadata', () => {
+ const names = new Set(wave2Cases.map((c) => c.action.name));
+ const actions = Object.values(gitlab.actions()).filter((a) => names.has(a.name));
+
+ it('every wave-2 action is ai with aiMetadata and an outputSchema', () => {
+ for (const action of actions) {
+ expect(action.audience, action.name).toBe('ai');
+ expect(action.aiMetadata?.description, action.name).toBeTruthy();
+ expect(typeof action.aiMetadata?.idempotent, action.name).toBe('boolean');
+ expect(action.outputSchema, action.name).toBeDefined();
+ }
+ });
+
+ it('classifies delete, cancel, archive and erase as DESTRUCTIVE and unarchive / unstar as WRITE', () => {
+ const destructive = actions.filter((a) => a.classification === 'DESTRUCTIVE').map((a) => a.name).sort();
+ expect(destructive).toEqual(
+ ['archive_project', 'cancel_job', 'cancel_pipeline', 'delete_group', 'delete_label', 'delete_milestone', 'delete_pipeline', 'delete_project', 'delete_project_webhook', 'erase_job'].sort()
+ );
+ const byName = Object.fromEntries(actions.map((a) => [a.name, a]));
+ expect(byName['unarchive_project'].classification).toBe('WRITE');
+ expect(byName['unstar_project'].classification).toBe('WRITE');
+ expect(byName['list_projects'].classification).toBe('SEARCH');
+ expect(byName['get_project'].classification).toBe('READ');
+ });
+
+ it('aiMetadata only names actions that agents can see', () => {
+ const all = Object.values(gitlab.actions());
+ const hidden = all.filter((a) => a.audience === 'human').map((a) => a.displayName);
+ for (const action of actions) {
+ for (const name of hidden) {
+ expect(action.aiMetadata?.description?.includes(name), `${action.name} names ${name}`).toBe(false);
+ }
+ }
+ });
+});
+
+describe('wave 2: rule checks', () => {
+ it('validates inputs before any request', async () => {
+ const seen = stubGitlab([]);
+ await expect(runAction({ action: getPipelineAction, propsValue: { ...P, pipelineId: -1 } })).rejects.toThrow('positive whole number');
+ await expect(runAction({ action: createPipelineAction, propsValue: { ...P, ref: 'main', variables: { 'BAD-NAME': 'x' } } })).rejects.toThrow('letters, digits');
+ await expect(runAction({ action: createPipelineAction, propsValue: { ...P, ref: ' ' } })).rejects.toThrow('Branch or Tag is required');
+ await expect(runAction({ action: getJobLogAction, propsValue: { ...P, jobId: 1, maxChars: 200000 } })).rejects.toThrow('at most');
+ await expect(runAction({ action: listPipelineJobsAction, propsValue: { ...P, pipelineId: 1, scope: ['exploded'] } })).rejects.toThrow('Unknown job status');
+ await expect(runAction({ action: createProjectAction, propsValue: {} })).rejects.toThrow('Name or a Path');
+ await expect(runAction({ action: listProjectsAction, propsValue: { membership: 'false' } })).rejects.toThrow('Member Only');
+ await expect(runAction({ action: forkProjectAction, propsValue: { ...P, namespaceId: 3, namespacePath: 'x' } })).rejects.toThrow('not both');
+ await expect(runAction({ action: shareProjectWithGroupAction, propsValue: { ...P, groupId: 4, groupAccess: 25 } })).rejects.toThrow('Access Level must be one of');
+ await expect(runAction({ action: updateGroupAction, propsValue: { groupId: 'g', clearDescription: false } })).rejects.toThrow('Set at least one field');
+ await expect(runAction({ action: createLabelAction, propsValue: { ...P, name: 'x', color: 'red; drop' } })).rejects.toThrow('hex color');
+ await expect(runAction({ action: updateLabelAction, propsValue: { ...P, labelId: 'x' } })).rejects.toThrow('Set at least one field');
+ await expect(runAction({ action: createMilestoneAction, propsValue: { ...P, title: 'v', dueDate: 'next week' } })).rejects.toThrow('YYYY-MM-DD');
+ await expect(runAction({ action: updateMilestoneAction, propsValue: { ...P, milestoneId: 1 } })).rejects.toThrow('Set at least one field');
+ await expect(runAction({ action: createProjectWebhookAction, propsValue: { ...P, url: 'ftp://x.example' } })).rejects.toThrow('http');
+ await expect(runAction({ action: updateProjectWebhookAction, propsValue: { ...P, hookId: 1 } })).rejects.toThrow('URL');
+ await expect(runAction({ action: updateProjectWebhookAction, propsValue: { ...P, hookId: 1, url: 'https://x.example', description: 'd', clearFields: ['description'] } })).rejects.toThrow('both set and cleared');
+ await expect(runAction({ action: updateProjectWebhookAction, propsValue: { ...P, hookId: 1, url: 'https://x.example', clearFields: ['token'] } })).rejects.toThrow('Unknown field');
+ expect(seen).toHaveLength(0);
+ });
+
+ it('list_projects can drop membership only with a search or owned filter', async () => {
+ const seen = stubGitlab([{ body: [] }]);
+ await runAction({ action: listProjectsAction, propsValue: { membership: 'false', search: 'kube' } });
+ expect(seen[0].query).toEqual({ search: 'kube', simple: 'true', page: '1', per_page: '20' });
+ });
+
+ it('star and unstar treat 304 as unchanged, read the project, and rethrow other errors', async () => {
+ const seen = stubGitlab([
+ { status: 304 },
+ { body: { id: 9, path_with_namespace: 'grp/proj', star_count: 1 } },
+ { status: 304 },
+ { body: { id: 9, path_with_namespace: 'grp/proj', star_count: 1 } },
+ { status: 403, body: { message: 'Forbidden' } },
+ ]);
+ expect(await runAction({ action: starProjectAction, propsValue: P })).toEqual({ starred: true, unchanged: true, projectId: 9, path_with_namespace: 'grp/proj', star_count: 1 });
+ expect(await runAction({ action: unstarProjectAction, propsValue: P })).toMatchObject({ starred: false, unchanged: true });
+ expect(seen.map((s) => s.method)).toEqual(['POST', 'GET', 'POST', 'GET']);
+ await expect(runAction({ action: starProjectAction, propsValue: P })).rejects.toThrow(/HTTP 403/);
+ });
+
+ it('import_project_members surfaces per-user errors instead of failing', async () => {
+ stubGitlab([
+ { status: 422, body: { status: 'error', message: { ann: 'Access level should be greater than or equal to Developer inherited membership' } } },
+ { status: 422, body: { message: 'other' } },
+ ]);
+ expect(await runAction({ action: importProjectMembersAction, propsValue: { ...P, sourceProjectId: 12 } })).toEqual({
+ status: 'error',
+ sourceProjectId: 12,
+ errors: [{ user: 'ann', message: 'Access level should be greater than or equal to Developer inherited membership' }],
+ });
+ await expect(runAction({ action: importProjectMembersAction, propsValue: { ...P, sourceProjectId: 12 } })).rejects.toThrow(/HTTP 422/);
+ });
+
+ it('archive_project treats already archived as success and rethrows other 400s', async () => {
+ const seen = stubGitlab([
+ { status: 400, body: { message: 'Project is already archived.' } },
+ { body: { id: 9, archived: true } },
+ { status: 400, body: { message: 'Something else' } },
+ ]);
+ expect(await runAction({ action: archiveProjectAction, propsValue: P })).toEqual({ id: 9, archived: true });
+ expect(seen.map((s) => s.method)).toEqual(['POST', 'GET']);
+ await expect(runAction({ action: archiveProjectAction, propsValue: P })).rejects.toThrow(/HTTP 400/);
+ });
+
+ it('import_project_members refuses a path as the source before any request', async () => {
+ const seen = stubGitlab([]);
+ await expect(runAction({ action: importProjectMembersAction, propsValue: { ...P, sourceProjectId: 'grp/other' } })).rejects.toThrow('positive whole number');
+ expect(seen).toHaveLength(0);
+ });
+
+ it('get_job_log removes terminal color codes and carriage returns', async () => {
+ stubGitlab([{ body: '\u001b[32;1mJob succeeded\u001b[0;m\r\n' }]);
+ expect(await runAction({ action: getJobLogAction, propsValue: { ...P, jobId: 2 } })).toEqual({ jobId: 2, log: 'Job succeeded\n', truncated: false, totalLength: 14 });
+ });
+
+ it('get_job_log drops section markers and keeps the last carriage-return rewrite', async () => {
+ stubGitlab([{ body: 'section_start:1700000000:step_script[collapsed=true]\r\u001b[0KRun\nprogress 10%\rprogress 100%\nsection_end:1700000001:step_script\r\u001b[0K\n' }]);
+ expect(await runAction({ action: getJobLogAction, propsValue: { ...P, jobId: 2 } })).toMatchObject({ log: 'Run\nprogress 100%\n\n' });
+ });
+
+ it('get_job_log keeps a line that ends in repeated carriage returns', async () => {
+ stubGitlab([{ body: 'ERROR: build failed\r\r\nnext\r\r' }]);
+ expect(await runAction({ action: getJobLogAction, propsValue: { ...P, jobId: 2 } })).toMatchObject({ log: 'ERROR: build failed\nnext' });
+ });
+
+ it('get_job_log returns a short log whole', async () => {
+ stubGitlab([{ body: 'all good' }]);
+ expect(await runAction({ action: getJobLogAction, propsValue: { ...P, jobId: 2 } })).toEqual({ jobId: 2, log: 'all good', truncated: false, totalLength: 8 });
+ });
+
+ it('update_project_webhook sends only the given URL, never reads it back, and strips tokens', async () => {
+ const seen = stubGitlab([{ body: { id: 3, url: 'https://keep.example/h', token: 'x' } }]);
+ const result = await runAction({ action: updateProjectWebhookAction, propsValue: { ...P, hookId: 3, url: 'https://keep.example/h', pipelineEvents: 'false', clearFields: ['description'] } });
+ expect(seen.map((s) => s.method)).toEqual(['PUT']);
+ expect(seen[0].body).toEqual({ url: 'https://keep.example/h', pipeline_events: false, description: '' });
+ expect(result).toEqual({ id: 3, url: 'https://keep.example/h' });
+ });
+
+ it('webhook actions take no secret token input', () => {
+ expect(Object.keys(createProjectWebhookAction.props)).not.toContain('token');
+ expect(Object.keys(updateProjectWebhookAction.props)).not.toContain('token');
+ });
+
+ it('list_project_webhooks strips tokens and keeps paging', async () => {
+ stubGitlab([{ body: [{ id: 1, url: 'https://a.example', token: 't' }], headers: { 'x-next-page': '2' } }]);
+ const result = await runAction({ action: listProjectWebhooksAction, propsValue: P });
+ expect(result).toHaveProperty('items', [{ id: 1, url: 'https://a.example' }]);
+ expect(result).toHaveProperty('nextPage', 2);
+ });
+
+ it('approval_state explains the Premium requirement on 403', async () => {
+ stubGitlab([{ status: 403, body: { message: '403 Forbidden' } }]);
+ await expect(runAction({ action: getMergeRequestApprovalStateAction, propsValue: { ...P, mergeRequestIid: 1 } })).rejects.toThrow(/Premium/);
+ });
+});
diff --git a/packages/pieces/community/gitlab/test/atomics.test.ts b/packages/pieces/community/gitlab/test/atomics.test.ts
index b49fabc9bde..af22f183649 100644
--- a/packages/pieces/community/gitlab/test/atomics.test.ts
+++ b/packages/pieces/community/gitlab/test/atomics.test.ts
@@ -62,6 +62,8 @@ import { getUserAction } from '../src/lib/actions/users/get-user';
import { listUsersAction } from '../src/lib/actions/users/list-users';
import { getUserStatusAction } from '../src/lib/actions/users/get-user-status';
import { setUserStatusAction } from '../src/lib/actions/users/set-user-status';
+
+import { wave2Cases } from './wave2-cases';
import { FAKE_DISPATCHER, rawPath, runAction, stubGitlab } from './helpers';
import { gitlabTransport } from '../src/lib/common/secret-request';
@@ -694,6 +696,7 @@ describe('exact outgoing request per atomic', () => {
it('covers every action registered on the piece except Custom API Call', () => {
const covered = new Set([
...cases.map((c) => c.action.name),
+ ...wave2Cases.map((c) => c.action.name),
'set_user_status',
'get_file',
]);
@@ -701,7 +704,7 @@ describe('exact outgoing request per atomic', () => {
(name) => name !== 'custom_api_call'
);
expect(registered.filter((name) => !covered.has(name))).toEqual([]);
- expect(registered).toHaveLength(55);
+ expect(registered).toHaveLength(113);
});
});
@@ -729,8 +732,9 @@ describe('metadata', () => {
});
it('destructive verbs are classified DESTRUCTIVE', () => {
+ const wave2 = new Set(wave2Cases.map((c) => c.action.name));
const destructive = actions
- .filter((a) => a.classification === 'DESTRUCTIVE')
+ .filter((a) => a.classification === 'DESTRUCTIVE' && !wave2.has(a.name))
.map((a) => a.name)
.sort();
expect(destructive).toEqual(
diff --git a/packages/pieces/community/gitlab/test/wave2-cases.ts b/packages/pieces/community/gitlab/test/wave2-cases.ts
new file mode 100644
index 00000000000..0cae2148a26
--- /dev/null
+++ b/packages/pieces/community/gitlab/test/wave2-cases.ts
@@ -0,0 +1,253 @@
+import { cancelJobAction } from '../src/lib/actions/ci/cancel-job';
+import { cancelPipelineAction } from '../src/lib/actions/ci/cancel-pipeline';
+import { createPipelineAction } from '../src/lib/actions/ci/create-pipeline';
+import { deletePipelineAction } from '../src/lib/actions/ci/delete-pipeline';
+import { eraseJobAction } from '../src/lib/actions/ci/erase-job';
+import { getJobLogAction } from '../src/lib/actions/ci/get-job-log';
+import { getJobAction } from '../src/lib/actions/ci/get-job';
+import { getPipelineAction } from '../src/lib/actions/ci/get-pipeline';
+import { listPipelineJobsAction } from '../src/lib/actions/ci/list-pipeline-jobs';
+import { listPipelinesAction } from '../src/lib/actions/ci/list-pipelines';
+import { playManualJobAction } from '../src/lib/actions/ci/play-manual-job';
+import { retryPipelineAction } from '../src/lib/actions/ci/retry-pipeline';
+import { archiveProjectAction } from '../src/lib/actions/projects/archive-project';
+import { createProjectAction } from '../src/lib/actions/projects/create-project';
+import { deleteProjectAction } from '../src/lib/actions/projects/delete-project';
+import { forkProjectAction } from '../src/lib/actions/projects/fork-project';
+import { getProjectLanguagesAction } from '../src/lib/actions/projects/get-project-languages';
+import { getProjectMemberAction } from '../src/lib/actions/projects/get-project-member';
+import { getProjectAction } from '../src/lib/actions/projects/get-project';
+import { importProjectMembersAction } from '../src/lib/actions/projects/import-project-members';
+import { listGroupProjectsAction } from '../src/lib/actions/projects/list-group-projects';
+import { listProjectGroupsAction } from '../src/lib/actions/projects/list-project-groups';
+import { listProjectInvitedGroupsAction } from '../src/lib/actions/projects/list-project-invited-groups';
+import { listProjectMembersAction } from '../src/lib/actions/projects/list-project-members';
+import { listProjectShareLocationsAction } from '../src/lib/actions/projects/list-project-share-locations';
+import { listProjectTransferLocationsAction } from '../src/lib/actions/projects/list-project-transfer-locations';
+import { listProjectUsersAction } from '../src/lib/actions/projects/list-project-users';
+import { listProjectsAction } from '../src/lib/actions/projects/list-projects';
+import { listUserProjectsAction } from '../src/lib/actions/projects/list-user-projects';
+import { shareProjectWithGroupAction } from '../src/lib/actions/projects/share-project-with-group';
+import { starProjectAction } from '../src/lib/actions/projects/star-project';
+import { unarchiveProjectAction } from '../src/lib/actions/projects/unarchive-project';
+import { unstarProjectAction } from '../src/lib/actions/projects/unstar-project';
+import { createGroupAction } from '../src/lib/actions/groups/create-group';
+import { deleteGroupAction } from '../src/lib/actions/groups/delete-group';
+import { getGroupMemberAction } from '../src/lib/actions/groups/get-group-member';
+import { getGroupAction } from '../src/lib/actions/groups/get-group';
+import { listGroupBillableMembersAction } from '../src/lib/actions/groups/list-group-billable-members';
+import { listGroupMembersAction } from '../src/lib/actions/groups/list-group-members';
+import { listGroupPendingMembersAction } from '../src/lib/actions/groups/list-group-pending-members';
+import { listGroupsAction } from '../src/lib/actions/groups/list-groups';
+import { updateGroupAction } from '../src/lib/actions/groups/update-group';
+import { createLabelAction } from '../src/lib/actions/labels/create-label';
+import { createMilestoneAction } from '../src/lib/actions/labels/create-milestone';
+import { deleteLabelAction } from '../src/lib/actions/labels/delete-label';
+import { deleteMilestoneAction } from '../src/lib/actions/labels/delete-milestone';
+import { getLabelAction } from '../src/lib/actions/labels/get-label';
+import { getMilestoneAction } from '../src/lib/actions/labels/get-milestone';
+import { listLabelsAction } from '../src/lib/actions/labels/list-labels';
+import { listMilestonesAction } from '../src/lib/actions/labels/list-milestones';
+import { updateLabelAction } from '../src/lib/actions/labels/update-label';
+import { updateMilestoneAction } from '../src/lib/actions/labels/update-milestone';
+import { createProjectWebhookAction } from '../src/lib/actions/webhooks/create-project-webhook';
+import { deleteProjectWebhookAction } from '../src/lib/actions/webhooks/delete-project-webhook';
+import { getProjectWebhookAction } from '../src/lib/actions/webhooks/get-project-webhook';
+import { listProjectWebhooksAction } from '../src/lib/actions/webhooks/list-project-webhooks';
+import { updateProjectWebhookAction } from '../src/lib/actions/webhooks/update-project-webhook';
+import { getMergeRequestApprovalStateAction } from '../src/lib/actions/merge-requests/get-merge-request-approval-state';
+import { runAction } from './helpers';
+
+export type Wave2Case = {
+ name: string;
+ action: Parameters<typeof runAction>[0]['action'];
+ props: Record<string, unknown>;
+ method: string;
+ path: string;
+ query?: Record<string, unknown>;
+ body?: Record<string, unknown>;
+ reply?: unknown;
+ result?: unknown;
+};
+
+const P = { projectId: 'grp/proj' };
+const PP = '/projects/grp%2Fproj';
+const G = { groupId: 'grp/sub' };
+const GP = '/groups/grp%2Fsub';
+const PAGE = { page: '1', per_page: '20' };
+
+export const wave2Cases: Wave2Case[] = [
+ {
+ name: 'create_pipeline',
+ action: createPipelineAction,
+ props: { ...P, ref: 'feat/x', variables: { DEPLOY_ENV: 'staging', DRY: 1 } },
+ method: 'POST',
+ path: `${PP}/pipeline`,
+ body: { ref: 'feat/x', variables: [{ key: 'DEPLOY_ENV', value: 'staging', variable_type: 'env_var' }, { key: 'DRY', value: '1', variable_type: 'env_var' }] },
+ },
+ { name: 'get_pipeline', action: getPipelineAction, props: { ...P, pipelineId: 11 }, method: 'GET', path: `${PP}/pipelines/11` },
+ {
+ name: 'list_pipelines',
+ action: listPipelinesAction,
+ props: { ...P, status: 'failed', ref: 'main', username: '@dev', updatedAfter: '2026-10-01', orderBy: 'updated_at', sort: 'desc', page: 2, perPage: 5 },
+ method: 'GET',
+ path: `${PP}/pipelines`,
+ query: { status: 'failed', ref: 'main', username: 'dev', updated_after: '2026-10-01', order_by: 'updated_at', sort: 'desc', page: '2', per_page: '5' },
+ },
+ { name: 'cancel_pipeline', action: cancelPipelineAction, props: { ...P, pipelineId: 11 }, method: 'POST', path: `${PP}/pipelines/11/cancel` },
+ { name: 'retry_pipeline', action: retryPipelineAction, props: { ...P, pipelineId: 11 }, method: 'POST', path: `${PP}/pipelines/11/retry` },
+ { name: 'delete_pipeline', action: deletePipelineAction, props: { ...P, pipelineId: 11 }, method: 'DELETE', path: `${PP}/pipelines/11`, reply: null, result: { deleted: true, pipelineId: 11 } },
+ {
+ name: 'list_pipeline_jobs',
+ action: listPipelineJobsAction,
+ props: { ...P, pipelineId: 11, scope: ['failed', 'manual'], includeRetried: 'true' },
+ method: 'GET',
+ path: `${PP}/pipelines/11/jobs`,
+ query: { 'scope[]': ['failed', 'manual'], include_retried: 'true', ...PAGE },
+ },
+ { name: 'get_job', action: getJobAction, props: { ...P, jobId: 21 }, method: 'GET', path: `${PP}/jobs/21` },
+ {
+ name: 'get_job_log',
+ action: getJobLogAction,
+ props: { ...P, jobId: 21, maxChars: 5 },
+ method: 'GET',
+ path: `${PP}/jobs/21/trace`,
+ reply: 'line one\nERROR',
+ result: { jobId: 21, log: 'ERROR', truncated: true, totalLength: 14 },
+ },
+ { name: 'cancel_job', action: cancelJobAction, props: { ...P, jobId: 21 }, method: 'POST', path: `${PP}/jobs/21/cancel` },
+ { name: 'play_manual_job', action: playManualJobAction, props: { ...P, jobId: 21, variables: { TARGET: 'prod' } }, method: 'POST', path: `${PP}/jobs/21/play`, body: { job_variables_attributes: [{ key: 'TARGET', value: 'prod' }] } },
+ { name: 'erase_job', action: eraseJobAction, props: { ...P, jobId: 21 }, method: 'POST', path: `${PP}/jobs/21/erase` },
+ {
+ name: 'create_project',
+ action: createProjectAction,
+ props: { name: 'Demo', namespaceId: 5, visibility: 'private', initializeWithReadme: true, defaultBranch: 'main' },
+ method: 'POST',
+ path: '/projects',
+ body: { name: 'Demo', namespace_id: 5, visibility: 'private', initialize_with_readme: true, default_branch: 'main' },
+ },
+ { name: 'get_project', action: getProjectAction, props: P, method: 'GET', path: PP },
+ {
+ name: 'list_projects',
+ action: listProjectsAction,
+ props: { search: 'demo', archived: 'false', orderBy: 'name', sort: 'asc' },
+ method: 'GET',
+ path: '/projects',
+ query: { membership: 'true', search: 'demo', archived: 'false', order_by: 'name', sort: 'asc', simple: 'true', ...PAGE },
+ },
+ {
+ name: 'delete_project',
+ action: deleteProjectAction,
+ props: P,
+ method: 'DELETE',
+ path: PP,
+ reply: { message: '202 Accepted' },
+ result: { deletionRequested: true, projectId: 'grp/proj', message: '202 Accepted' },
+ },
+ { name: 'archive_project', action: archiveProjectAction, props: P, method: 'POST', path: `${PP}/archive` },
+ { name: 'unarchive_project', action: unarchiveProjectAction, props: P, method: 'POST', path: `${PP}/unarchive` },
+ { name: 'fork_project', action: forkProjectAction, props: { ...P, namespacePath: 'team', path: 'copy' }, method: 'POST', path: `${PP}/fork`, body: { namespace_path: 'team', path: 'copy' } },
+ {
+ name: 'star_project',
+ action: starProjectAction,
+ props: P,
+ method: 'POST',
+ path: `${PP}/star`,
+ reply: { id: 9, path_with_namespace: 'grp/proj', star_count: 3, name: 'proj' },
+ result: { starred: true, unchanged: false, projectId: 9, path_with_namespace: 'grp/proj', star_count: 3 },
+ },
+ {
+ name: 'unstar_project',
+ action: unstarProjectAction,
+ props: P,
+ method: 'POST',
+ path: `${PP}/unstar`,
+ reply: { id: 9, path_with_namespace: 'grp/proj', star_count: 2 },
+ result: { starred: false, unchanged: false, projectId: 9, path_with_namespace: 'grp/proj', star_count: 2 },
+ },
+ {
+ name: 'get_project_languages',
+ action: getProjectLanguagesAction,
+ props: P,
+ method: 'GET',
+ path: `${PP}/languages`,
+ reply: { Shell: 10.5, TypeScript: 89.5 },
+ result: { languages: [{ language: 'TypeScript', percentage: 89.5 }, { language: 'Shell', percentage: 10.5 }], count: 2 },
+ },
+ {
+ name: 'list_project_groups',
+ action: listProjectGroupsAction,
+ props: { ...P, search: 'a', withShared: 'true', sharedMinAccessLevel: 30 },
+ method: 'GET',
+ path: `${PP}/groups`,
+ query: { search: 'a', with_shared: 'true', shared_min_access_level: '30', ...PAGE },
+ },
+ { name: 'list_project_invited_groups', action: listProjectInvitedGroupsAction, props: { ...P, minAccessLevel: 20 }, method: 'GET', path: `${PP}/invited_groups`, query: { min_access_level: '20', ...PAGE } },
+ { name: 'list_project_share_locations', action: listProjectShareLocationsAction, props: { ...P, search: 'team' }, method: 'GET', path: `${PP}/share_locations`, query: { search: 'team', ...PAGE } },
+ { name: 'list_project_transfer_locations', action: listProjectTransferLocationsAction, props: P, method: 'GET', path: `${PP}/transfer_locations`, query: PAGE },
+ {
+ name: 'share_project_with_group',
+ action: shareProjectWithGroupAction,
+ props: { ...P, groupId: 44, groupAccess: 30, expiresAt: '2026-12-31' },
+ method: 'POST',
+ path: `${PP}/share`,
+ body: { group_id: 44, group_access: 30, expires_at: '2026-12-31' },
+ },
+ { name: 'list_user_projects', action: listUserProjectsAction, props: { userId: 15, visibility: 'public' }, method: 'GET', path: '/users/15/projects', query: { visibility: 'public', simple: 'true', ...PAGE } },
+ { name: 'list_group_projects', action: listGroupProjectsAction, props: { ...G, includeSubgroups: 'true' }, method: 'GET', path: `${GP}/projects`, query: { include_subgroups: 'true', simple: 'true', ...PAGE } },
+ {
+ name: 'import_project_members',
+ action: importProjectMembersAction,
+ props: { ...P, sourceProjectId: 99 },
+ method: 'POST',
+ path: `${PP}/import_project_members/99`,
+ reply: { status: 'success' },
+ result: { status: 'success', sourceProjectId: 99, errors: [] },
+ },
+ { name: 'list_project_users', action: listProjectUsersAction, props: { ...P, search: 'ann' }, method: 'GET', path: `${PP}/users`, query: { search: 'ann', ...PAGE } },
+ { name: 'list_project_members', action: listProjectMembersAction, props: { ...P, query: 'ann' }, method: 'GET', path: `${PP}/members/all`, query: { query: 'ann', ...PAGE } },
+ { name: 'get_project_member (direct)', action: getProjectMemberAction, props: { ...P, userId: 15 }, method: 'GET', path: `${PP}/members/15` },
+ { name: 'get_project_member (inherited)', action: getProjectMemberAction, props: { ...P, userId: 15, includeInherited: 'true' }, method: 'GET', path: `${PP}/members/all/15` },
+ { name: 'create_group', action: createGroupAction, props: { name: 'Team', path: 'team', parentId: 7, visibility: 'private' }, method: 'POST', path: '/groups', body: { name: 'Team', path: 'team', parent_id: 7, visibility: 'private' } },
+ { name: 'get_group', action: getGroupAction, props: G, method: 'GET', path: GP, query: { with_projects: 'false' } },
+ { name: 'list_groups', action: listGroupsAction, props: { search: 'te', owned: 'true', topLevelOnly: 'false', minAccessLevel: 40 }, method: 'GET', path: '/groups', query: { search: 'te', owned: 'true', top_level_only: 'false', min_access_level: '40', ...PAGE } },
+ { name: 'update_group', action: updateGroupAction, props: { ...G, name: 'New', clearDescription: true }, method: 'PUT', path: GP, body: { name: 'New', description: '' } },
+ { name: 'delete_group', action: deleteGroupAction, props: G, method: 'DELETE', path: GP, reply: { message: '202 Accepted' }, result: { deletionRequested: true, groupId: 'grp/sub', message: '202 Accepted' } },
+ { name: 'get_group_member', action: getGroupMemberAction, props: { ...G, userId: 15 }, method: 'GET', path: `${GP}/members/15` },
+ { name: 'list_group_members (direct)', action: listGroupMembersAction, props: G, method: 'GET', path: `${GP}/members`, query: PAGE },
+ { name: 'list_group_members (inherited)', action: listGroupMembersAction, props: { ...G, includeInherited: 'true', query: 'ann' }, method: 'GET', path: `${GP}/members/all`, query: { query: 'ann', ...PAGE } },
+ { name: 'list_group_billable_members', action: listGroupBillableMembersAction, props: { groupId: 'grp', sort: 'name_asc' }, method: 'GET', path: '/groups/grp/billable_members', query: { sort: 'name_asc', ...PAGE } },
+ { name: 'list_group_pending_members', action: listGroupPendingMembersAction, props: { groupId: 'grp' }, method: 'GET', path: '/groups/grp/pending_members', query: PAGE },
+ { name: 'create_label', action: createLabelAction, props: { ...P, name: 'bug', color: '#FF0000', priority: 0 }, method: 'POST', path: `${PP}/labels`, body: { name: 'bug', color: '#FF0000', priority: 0 } },
+ { name: 'get_label', action: getLabelAction, props: { ...P, labelId: 'needs review' }, method: 'GET', path: `${PP}/labels/needs%20review` },
+ { name: 'list_labels', action: listLabelsAction, props: { ...P, search: 'bu', includeAncestorGroups: 'false' }, method: 'GET', path: `${PP}/labels`, query: { search: 'bu', include_ancestor_groups: 'false', ...PAGE } },
+ { name: 'update_label', action: updateLabelAction, props: { ...P, labelId: 'bug', newName: 'defect', clearPriority: true }, method: 'PUT', path: `${PP}/labels/bug`, body: { new_name: 'defect', priority: null } },
+ { name: 'delete_label', action: deleteLabelAction, props: { ...P, labelId: 'a/b' }, method: 'DELETE', path: `${PP}/labels/a%2Fb`, reply: null, result: { deleted: true, label: 'a/b' } },
+ { name: 'create_milestone', action: createMilestoneAction, props: { ...P, title: 'v1', dueDate: '2026-12-01' }, method: 'POST', path: `${PP}/milestones`, body: { title: 'v1', due_date: '2026-12-01' } },
+ { name: 'get_milestone', action: getMilestoneAction, props: { ...P, milestoneId: 31 }, method: 'GET', path: `${PP}/milestones/31` },
+ { name: 'list_milestones', action: listMilestonesAction, props: { ...P, state: 'active', title: 'v1' }, method: 'GET', path: `${PP}/milestones`, query: { state: 'active', title: 'v1', ...PAGE } },
+ { name: 'update_milestone', action: updateMilestoneAction, props: { ...P, milestoneId: 31, stateEvent: 'close', clearDueDate: true }, method: 'PUT', path: `${PP}/milestones/31`, body: { due_date: '', state_event: 'close' } },
+ { name: 'delete_milestone', action: deleteMilestoneAction, props: { ...P, milestoneId: 31 }, method: 'DELETE', path: `${PP}/milestones/31`, reply: null, result: { deleted: true, milestoneId: 31 } },
+ {
+ name: 'create_project_webhook',
+ action: createProjectWebhookAction,
+ props: { ...P, url: 'https://example.com/hook', pushEvents: 'false', issuesEvents: 'true', pushEventsBranchFilter: 'main' },
+ method: 'POST',
+ path: `${PP}/hooks`,
+ body: { url: 'https://example.com/hook', push_events: false, issues_events: true, push_events_branch_filter: 'main' },
+ reply: { id: 3, url: 'https://example.com/hook', token: 'echoed' },
+ result: { id: 3, url: 'https://example.com/hook' },
+ },
+ { name: 'get_project_webhook', action: getProjectWebhookAction, props: { ...P, hookId: 3 }, method: 'GET', path: `${PP}/hooks/3` },
+ { name: 'list_project_webhooks', action: listProjectWebhooksAction, props: P, method: 'GET', path: `${PP}/hooks`, query: PAGE },
+ {
+ name: 'update_project_webhook',
+ action: updateProjectWebhookAction,
+ props: { ...P, hookId: 3, url: 'https://example.com/new', noteEvents: 'true', clearFields: ['push_events_branch_filter'] },
+ method: 'PUT',
+ path: `${PP}/hooks/3`,
+ body: { url: 'https://example.com/new', note_events: true, push_events_branch_filter: '' },
+ },
+ { name: 'delete_project_webhook', action: deleteProjectWebhookAction, props: { ...P, hookId: 3 }, method: 'DELETE', path: `${PP}/hooks/3`, reply: null, result: { deleted: true, hookId: 3 } },
+ { name: 'get_merge_request_approval_state', action: getMergeRequestApprovalStateAction, props: { ...P, mergeRequestIid: 4 }, method: 'GET', path: `${PP}/merge_requests/4/approval_state` },
+];