Skip to content

Commit

Permalink
docs: update wording for using --affected filter (#9591)
Browse files Browse the repository at this point in the history
As part of #9329, open to other suggestions on improving the clarity

- Filtering happens for packages with changes across git commits
- Filtering does not consider inputs to tasks in those packages

Co-authored-by: Anthony Shew <[email protected]>
  • Loading branch information
taesungh and anthonyshew authored Feb 14, 2025
1 parent 623f61c commit b01f626
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/turborepo-lib/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ pub struct ExecutionArgs {
#[clap(short = 'F', long, group = "scope-filter-group")]
pub filter: Vec<String>,

/// Run only tasks that are affected by changes between
/// Filter to only packages that are affected by changes between
/// the current branch and `main`
#[clap(long, group = "scope-filter-group", conflicts_with = "filter")]
pub affected: bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ You'll want to use this flag in situations like:

CI/CD pipelines are a perfect place to use `--affected`. With `--affected`, Turborepo can automatically detect that you're running in GitHub Actions by inspecting environment variables set by GitHub, like `GITHUB_BASE_REF`.

In the context of a PR, this means that Turborepo can determine which packages have changed between the PR's base branch and the PR's head branch. This allows you to run only the tasks that are affected by the changes in the PR.
In the context of a PR, this means that Turborepo can determine which packages have changed between the PR's base branch and the PR's head branch. This allows you to run tasks only for the packages that are affected by the changes in the PR.

While `GITHUB_BASE_REF` works well in `pull_request` and `pull_request_target` events, it is not available during regular push events. In those cases, we use `GITHUB_EVENT_PATH` to determine the base branch to compare your commit to. In force pushes and pushing branch with no additionals commits, we compare to the parent of the first commit on the branch.

Expand Down
2 changes: 1 addition & 1 deletion docs/repo-docs/crafting-your-repository/running-tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ turbo dev --filter=web...

### Filtering by source control changes

Using filters to run tasks based on changes in source control is a great way to run only the tasks for packages that are affected by your changes. **Source control filters must be wrapped in `[]`**.
Using filters to run tasks based on changes in source control is a great way to run tasks only for the packages that are affected by your changes. **Source control filters must be wrapped in `[]`**.

- **Comparing to the previous commit**: `turbo build --filter=[HEAD^1]`
- **Comparing to the main branch**: `turbo build --filter=[main...my-feature]`
Expand Down
2 changes: 1 addition & 1 deletion turborepo-tests/integration/tests/no-args.t
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Make sure exit code is 2 when no args are passed
-F, --filter <FILTER>
Use the given selector to specify package(s) to act as entry points. The syntax mirrors pnpm's syntax, and additional documentation and examples can be found in turbo's documentation https://turbo.build/repo/docs/reference/command-line-reference/run#--filter
--affected
Run only tasks that are affected by changes between the current branch and `main`
Filter to only packages that are affected by changes between the current branch and `main`
--output-logs <OUTPUT_LOGS>
Set type of process output logging. Use "full" to show all output. Use "hash-only" to show only turbo-computed task hashes. Use "new-only" to show only new output with only hashes for cached tasks. Use "none" to hide process output. (default full) [possible values: full, none, hash-only, new-only, errors-only]
--log-order <LOG_ORDER>
Expand Down
4 changes: 2 additions & 2 deletions turborepo-tests/integration/tests/turbo-help.t
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Test help flag
-F, --filter <FILTER>
Use the given selector to specify package(s) to act as entry points. The syntax mirrors pnpm's syntax, and additional documentation and examples can be found in turbo's documentation https://turbo.build/repo/docs/reference/command-line-reference/run#--filter
--affected
Run only tasks that are affected by changes between the current branch and `main`
Filter to only packages that are affected by changes between the current branch and `main`
--output-logs <OUTPUT_LOGS>
Set type of process output logging. Use "full" to show all output. Use "hash-only" to show only turbo-computed task hashes. Use "new-only" to show only new output with only hashes for cached tasks. Use "none" to hide process output. (default full) [possible values: full, none, hash-only, new-only, errors-only]
--log-order <LOG_ORDER>
Expand Down Expand Up @@ -297,7 +297,7 @@ Test help flag
Use the given selector to specify package(s) to act as entry points. The syntax mirrors pnpm's syntax, and additional documentation and examples can be found in turbo's documentation https://turbo.build/repo/docs/reference/command-line-reference/run#--filter

--affected
Run only tasks that are affected by changes between the current branch and `main`
Filter to only packages that are affected by changes between the current branch and `main`

--output-logs <OUTPUT_LOGS>
Set type of process output logging. Use "full" to show all output. Use "hash-only" to show only turbo-computed task hashes. Use "new-only" to show only new output with only hashes for cached tasks. Use "none" to hide process output. (default full)
Expand Down

0 comments on commit b01f626

Please sign in to comment.