Ccodemod

codemod/azure-pipelines-lock-swift-deps

Add dependency-locking flags to inline Swift and xcodebuild commands in Azure Pipelines YAML.

transformationazure-pipelinesswiftsecurity
Public
0 executions

Run locally

npx codemod @codemod/azure-pipelines-lock-swift-deps

@codemod/azure-pipelines-lock-swift-deps

Add dependency-locking flags to inline Swift and xcodebuild commands in Azure Pipelines YAML so CI uses checked-in package resolution data instead of resolving packages opportunistically.

Installation

bash

Usage

This codemod rewrites Azure Pipelines YAML command values under script, bash, and pwsh keys.

  • swift build ... -> swift build --disable-automatic-resolution ...
  • swift test ... -> swift test --disable-automatic-resolution ...
  • xcodebuild ... build|test|archive|analyze -> inserts both -disableAutomaticPackageResolution and -onlyUsePackageVersionsFromResolvedFile
  • xcodebuild -resolvePackageDependencies ... -> inserts the same two xcodebuild flags

Preserve cases:

  • Commands that already include the lock flags stay unchanged
  • Non-Swift commands stay unchanged
  • Commented lines inside block scalars stay unchanged

Target files:

  • **/*.yml
  • **/*.yaml

Development

bash

License

MIT

Ready to contribute?

Build your own codemod and share it with the community.