Allow to stop running workflow (#15270)

https://github.com/user-attachments/assets/599154e4-8743-471b-b05a-721b635bcf4e

On stoppage:
- if no running steps, mark pending as failed and end the workflow
- if running steps, set as stopping and exit. Going to the next step, as
the workflow is not running anymore, it will naturally stop
This commit is contained in:
Thomas Trompette
2025-10-23 15:01:15 +02:00
committed by GitHub
parent 1cf442966d
commit 4effa5351c
23 changed files with 532 additions and 70 deletions
@@ -1825,7 +1825,7 @@ export type Mutation = {
restorePageLayoutWidget: PageLayoutWidget;
retryJobs: RetryJobsResponse;
revokeApiKey?: Maybe<ApiKey>;
runWorkflowVersion: WorkflowRun;
runWorkflowVersion: RunWorkflowVersionOutput;
saveImapSmtpCaldavAccount: ImapSmtpCaldavConnectionSuccess;
sendInvitations: SendInvitationsOutput;
setMeteredSubscriptionPrice: BillingUpdateOutput;
@@ -1836,6 +1836,7 @@ export type Mutation = {
skipBookOnboardingStep: OnboardingStepSuccess;
skipSyncEmailOnboardingStep: OnboardingStepSuccess;
startChannelSync: ChannelSyncSuccess;
stopWorkflowRun: WorkflowRun;
submitFormStep: Scalars['Boolean'];
switchBillingPlan: BillingUpdateOutput;
switchSubscriptionInterval: BillingUpdateOutput;
@@ -2516,6 +2517,11 @@ export type MutationStartChannelSyncArgs = {
};
export type MutationStopWorkflowRunArgs = {
workflowRunId: Scalars['UUID'];
};
export type MutationSubmitFormStepArgs = {
input: SubmitFormStepInput;
};
@@ -3702,6 +3708,11 @@ export type RunWorkflowVersionInput = {
workflowVersionId: Scalars['UUID'];
};
export type RunWorkflowVersionOutput = {
__typename?: 'RunWorkflowVersionOutput';
workflowRunId: Scalars['UUID'];
};
export type SsoConnection = {
__typename?: 'SSOConnection';
id: Scalars['UUID'];
@@ -4585,9 +4596,21 @@ export enum WorkflowActionType {
export type WorkflowRun = {
__typename?: 'WorkflowRun';
workflowRunId: Scalars['UUID'];
id: Scalars['UUID'];
status: WorkflowRunStatusEnum;
};
/** Status of the workflow run */
export enum WorkflowRunStatusEnum {
COMPLETED = 'COMPLETED',
ENQUEUED = 'ENQUEUED',
FAILED = 'FAILED',
NOT_STARTED = 'NOT_STARTED',
RUNNING = 'RUNNING',
STOPPED = 'STOPPED',
STOPPING = 'STOPPING'
}
export type WorkflowStepPosition = {
__typename?: 'WorkflowStepPosition';
x: Scalars['Float'];
@@ -6152,7 +6175,14 @@ export type RunWorkflowVersionMutationVariables = Exact<{
}>;
export type RunWorkflowVersionMutation = { __typename?: 'Mutation', runWorkflowVersion: { __typename?: 'WorkflowRun', workflowRunId: string } };
export type RunWorkflowVersionMutation = { __typename?: 'Mutation', runWorkflowVersion: { __typename?: 'RunWorkflowVersionOutput', workflowRunId: string } };
export type StopWorkflowRunMutationVariables = Exact<{
workflowRunId: Scalars['UUID'];
}>;
export type StopWorkflowRunMutation = { __typename?: 'Mutation', stopWorkflowRun: { __typename: 'WorkflowRun', id: string, status: WorkflowRunStatusEnum } };
export type UpdateWorkflowRunStepMutationVariables = Exact<{
input: UpdateWorkflowRunStepInput;
@@ -13865,6 +13895,41 @@ export function useRunWorkflowVersionMutation(baseOptions?: Apollo.MutationHookO
export type RunWorkflowVersionMutationHookResult = ReturnType<typeof useRunWorkflowVersionMutation>;
export type RunWorkflowVersionMutationResult = Apollo.MutationResult<RunWorkflowVersionMutation>;
export type RunWorkflowVersionMutationOptions = Apollo.BaseMutationOptions<RunWorkflowVersionMutation, RunWorkflowVersionMutationVariables>;
export const StopWorkflowRunDocument = gql`
mutation StopWorkflowRun($workflowRunId: UUID!) {
stopWorkflowRun(workflowRunId: $workflowRunId) {
id
status
__typename
}
}
`;
export type StopWorkflowRunMutationFn = Apollo.MutationFunction<StopWorkflowRunMutation, StopWorkflowRunMutationVariables>;
/**
* __useStopWorkflowRunMutation__
*
* To run a mutation, you first call `useStopWorkflowRunMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useStopWorkflowRunMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [stopWorkflowRunMutation, { data, loading, error }] = useStopWorkflowRunMutation({
* variables: {
* workflowRunId: // value for 'workflowRunId'
* },
* });
*/
export function useStopWorkflowRunMutation(baseOptions?: Apollo.MutationHookOptions<StopWorkflowRunMutation, StopWorkflowRunMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<StopWorkflowRunMutation, StopWorkflowRunMutationVariables>(StopWorkflowRunDocument, options);
}
export type StopWorkflowRunMutationHookResult = ReturnType<typeof useStopWorkflowRunMutation>;
export type StopWorkflowRunMutationResult = Apollo.MutationResult<StopWorkflowRunMutation>;
export type StopWorkflowRunMutationOptions = Apollo.BaseMutationOptions<StopWorkflowRunMutation, StopWorkflowRunMutationVariables>;
export const UpdateWorkflowRunStepDocument = gql`
mutation UpdateWorkflowRunStep($input: UpdateWorkflowRunStepInput!) {
updateWorkflowRunStep(input: $input) {