# Workflow

> The Xcode Cloud workflow editor: name, project, Xcode and macOS, when it starts, and the actions it runs. Titled New Workflow for a new one, or the workflow's name.

Source: https://air.build/docs/screens/developer/workflow/

The Workflow sheet edits one Xcode Cloud workflow: what it's called and which project it builds, the Xcode and macOS it builds with, when it starts, and the actions it runs. Nothing is written to App Store Connect until you tap **Create** or **Save**. For a new workflow the sheet is titled **New Workflow**; for an existing one, it carries the workflow's name.

## Open it

On the [Xcode Cloud](https://air.build/docs/screens/developer/xcode-cloud/) tab, under **Workflows**:

- tap **New Workflow…** for a new one;
- tap a workflow to edit it, or touch and hold it (on the Mac, right-click) and choose **Edit Workflow…**.

**iPhone**

**Cancel** is at the top left and **Create** or **Save** at the top right. **Delete Workflow** is at the bottom.

**Mac**

**Delete Workflow**, **Cancel** and **Create** or **Save** are along the bottom of the dialog.

## What's on it

### The workflow

| Field | What it's for | Default for a new workflow |
| --- | --- | --- |
| **Name** | The workflow's name. Required. | Empty |
| **Description** | Up to three lines about it. | Empty |
| **Enabled** | Whether the workflow runs. | On |
| **Clean Build** | Start every build from a fresh checkout. | Off |
| **Project or Workspace** | The path to the project or workspace, relative to the repository root, for example `App.xcodeproj`. Required. | The path the app's other workflows use |
| **Locked for Editing** | Existing workflows only. "A locked workflow can't be changed until it is unlocked here or in Xcode." While it's locked, the other fields are dimmed. |  |
| **Repository** | New workflows only. A picker when the product has more than one repository; otherwise the one repository, fixed. | The product's first repository |

Footer: "The project or workspace path, relative to the repository root. A clean build starts from a fresh checkout every time."

### Environment

| Field | What it's for | Default for a new workflow |
| --- | --- | --- |
| **Xcode** | The Xcode version to build with. | The newest Xcode Cloud offers |
| **macOS** | The macOS to build on. Lists only the versions that run the chosen Xcode; changing Xcode swaps an unsuitable macOS for the newest that fits. | The newest for that Xcode |

### Start Conditions

Each switch adds a way for the workflow to start. Its fields show when it's on.

| Switch | Fields |
| --- | --- |
| **Branch Changes** | **Branches**; **Auto-Cancel Builds** (on when added). |
| **Tag Changes** | **Tags**. |
| **Pull Request Changes** | **Source Branches**, **Target Branches**. |

Footer: "Branch and tag names, separated by commas. A trailing \* matches everything under a prefix — release/\* takes release/1.0 and release/2.0. Leave a field empty to match any."

### On a Schedule

| Switch | Fields |
| --- | --- |
| **On a Schedule** | **Branches** (main when added); **Frequency**: **Weekly**, **Daily** (default) or **Hourly**; **Days** for Weekly ("Choose…" until you pick); **Time** (9:00 when added; not for Hourly); **Time Zone**, your current time zone, shown but not editable. |

### Manual Start

| Switch | Fields | Default for a new workflow |
| --- | --- | --- |
| **Manually from Branches** | **Branches** | On, any branch |
| **Manually from Tags** | **Tags** | Off |
| **Manually from Pull Requests** | **Source Branches**, **Target Branches** | Off |

### Actions

One section per action, headed with its name.

| Field | What it's for | Default for an added action |
| --- | --- | --- |
| **Action** | **Build**, **Analyze**, **Test** or **Archive**. | **Build** |
| **Name** | The action's name. Filled in from the kind when empty. | "Build" |
| **Scheme** | The Xcode scheme. Required. | The scheme of the action above, or of the app's other workflows |
| **Platform** | **iOS**, **macOS**, **tvOS**, **watchOS** or **visionOS**. | **iOS** |
| **Destination** | Where it builds for, from the platform's choices, for example **Any iOS Device** or **Any iOS Preview**. Changing the platform picks its first destination. | **Any iOS Preview** |
| **Distribution** | Archive only: **None**, **Internal Testing Only** or **TestFlight and App Store**. | **None** |
| **Required to Pass** | Whether the build fails when this action fails. | On |
| **Remove Action** | Removes the action from the list. |  |

**Add Action…** adds another.

## Create or change a workflow

1. Fill in **Name** and **Project or Workspace**, and wait for **Xcode** and **macOS** to fill in.
2. Turn on at least one start condition or manual start, and fill in the branches or tags it applies to.
3. Check each action has a **Scheme**. Add or remove actions as needed.
4. Tap **Create** (new) or **Save** (existing). The sheet closes when App Store Connect accepts it.

**Create** or **Save** stays dimmed until the workflow has a name, a project path, an Xcode and a macOS, at least one action, a scheme on every action and at least one way to start. **Save** also needs a change.

## Messages

| Message | When | What to do |
| --- | --- | --- |
| "A workflow needs at least one way to start." | Every start condition and manual start is off. | Turn one on. |
| "A workflow needs at least one action." | You removed every action. | Tap **Add Action…**. |
| The reason, at the end of the sheet | App Store Connect refused the workflow. | Fix what it names and save again. |
| The reason, with **Try Again**, under **Environment** | The Xcode and macOS versions couldn't be read. | Tap **Try Again**. |
| "Delete _name_?": "The workflow stops running and can't be brought back. Its earlier builds stay." | You tapped **Delete Workflow**. | **Delete Workflow** deletes it and closes the sheet. |

**Delete Workflow** is dimmed while the workflow is being changed.
