Examples

Action usage examples

Examples give users ideas on actual usage. We use automation to generate, test, and run these actions, so names and combinations may be odd or repetitive (wink). In many cases, other actions or environmental setup is required for the action to run, so you will need to adjust the action parameters and setup appropriate for your environment. 

Command line environments can be different, especially between Windows and non-Windows systems. Our Tips page talks about command line escaping differences and there are differences with respect to environment variable references ($ for non-Windows and %...% for Windows). These differences can impact examples, so recognize and adjust for your platform. In particular, all examples here are run with the standard bash shell on Linux.



createProject

--action createProject --project "AUT1" --name "AutomationTestProject1" --description "Automation Test Project 1" --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"
--action createProject --project "AUT2" --name "AutomationTestProject2" --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"

deleteProject

--action deleteProject --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}" --project "AUT1"
--action deleteProject --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}" --project "AutomationTestProject2"

getBranch

--action getBranch --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --branch "master"

getBranchList

--action getBranchList --owner "@self"
--action getBranchList --owner "{ecddc0da-f8fa-43aa-bc5f-72bad652fc56}" --repository "{ec85a580-b4b8-4d87-b355-5e7eabdea3d5}"

getBuildStatusList

--action getBuildStatusList --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --branch "master"

getClientInfo

--action getClientInfo
--action getClientInfo --outputFormat 2

getCommit

--action getCommit --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --commit "dbd93a47b17145543627edea5c61065d46e29582"
--action getCommit --owner "{ecddc0da-f8fa-43aa-bc5f-72bad652fc56}" --repository "{ec85a580-b4b8-4d87-b355-5e7eabdea3d5}" --commit "f571f689166cb1cd177bc115be0c0a5d39757c0c"

getCommitList

--action getCommitList --owner "@self"
--action getCommitList --owner "@self" --repository "{ec85a580-b4b8-4d87-b355-5e7eabdea3d5}"
--action getCommitList --owner "{ecddc0da-f8fa-43aa-bc5f-72bad652fc56}" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --regex ".*AutomationTestFile1.*"
--action getCommitList --owner "{ecddc0da-f8fa-43aa-bc5f-72bad652fc56}" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --regex "dbd93a47b17145543627edea5c61065d46e29582"

getFileList

--action getFileList --repository "base-cli" --path ""
--action getFileList --repository "base-cli" --path "" --dateFormat "yyyy-MM-dd HH:mm:ss" --descendents
--action getFileList --repository "base-cli" --path "" --dateFormat "yyyy-MM-dd HH:mm:ss" --descendents --regex "src/itest.*"
--action getFileList --repository "base-cli" --path "license" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getFileList --repository "base-cli" --path "license" --dateFormat "yyyy-MM-dd HH:mm:ss" --outputFormat 999
--action getFileList --repository "gint" --owner "gint_org" --dateFormat "yyyy-MM-dd HH:mm:ss" --descendents

getProject

--action getProject --project "BOB" --team "{38562f68-952a-4f1e-abec-07c7a3485732}"
--action getProject --project "CLI"

getProjectList

--action getProjectList
--action getProjectList --limit 2
--action getProjectList --regex "AUT.*"
--action getProjectList --regex "Bob.*Project" --dateFormat "yyyy-MM-dd HH:mm:ss" --limit 1
--action getProjectList --role "owner"
--action getProjectList --team "bobswift-test-team" --role "owner"
--action getProjectList --team "bobswiftautomationtest"
--action getProjectList --team "bobswiftautomationtest" --role "member"
--action getProjectList --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"

getPullRequest

--action getPullRequest --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --pullRequest 5

getPullRequestList

--action getPullRequestList --owner "@self"
--action getPullRequestList --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}"
--action getPullRequestList --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --regex "AutomationTestFile1.*"
--action getPullRequestList --owner "@self" --repository "{c544c3d5-6941-456e-be8e-0ba8d2b4c491}" --state "DECLINED"

getRepository

--action getRepository --repository "base-cli"
--action getRepository --repository "gint" --owner "gint_org"

getRepositoryList

--action getRepositoryList --file "output/clibc/getRepositoryList.txt"
--action getRepositoryList --owner "@self"
--action getRepositoryList --owner "bobswift-test"
--action getRepositoryList --owner "gint_org"
--action getRepositoryList --query "is_private=true" --columns "-1"

getSource

--action getSource --repository "base-cli" --path "build.gradle"
--action getSource --repository "gint" --owner "gint_org" --path "build.gradle"

getTeam

--action getTeam --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}" --dateFormat "yyyy-MM-dd HH:mm:ss"

getTeamList

--action getTeamList
--action getTeamList --dateFormat "yyyy-MM-dd HH:mm:ss" --role "owner"
--action getTeamList --regex "bob.*test" --role "collaborator"
--action getTeamList --role "owner"

getUser

--action getUser --dateFormat "yyyy-MM-dd"

getWorkspace

--action getWorkspace --workspace "Test Automation (Bob Swift Atlassian Apps)" --dateFormat "yyyy-MM-dd"
--action getWorkspace --workspace "bobswiftautomationtest" --dateFormat "yyyy-MM-dd"

getWorkspaceList

--action getWorkspaceList --outputType "text" --dateFormat "yyyy-MM-dd" --options "tableNoWrap"

publishSource

--action publishSource --repository "base-cli" --path "build.gradle" --title "build" --replace --space "experiment" --parent "@home" --targetServer "confluence210"
--action publishSource --repository "base-cli" --path "build.gradle" --title "build" --replace --space "experiment" --parent "@home" --targetServer "confluence30"
--action publishSource --repository "base-cli" --path "license" --title "licenses" --options "name,h1" --replace --space "experiment" --parent "@home" --targetServer "confluence210"
--action publishSource --repository "base-cli" --path "license" --title "licenses" --options "name,h1" --replace --space "experiment" --parent "@home" --targetServer "confluence30"
--action publishSource --repository "base-cli" --path "src/main/java/org/swift/common/cli/CliClient.java" --title "Example.java with full path" --options "path,language=java,collapse" --replace --space "experiment" --parent "@home" --targetServer "confluence210"
--action publishSource --repository "base-cli" --path "src/main/java/org/swift/common/cli/CliClient.java" --title "Example.java with full path" --options "path,language=java,collapse" --replace --space "experiment" --parent "@home" --targetServer "confluence30"
--action publishSource --repository "base-cli" --path "src/main/java/org/swift/common/cli/CliClient.java" --title "Example.java" --options "name,lineNumbers,theme=midnight" --replace --space "experiment" --parent "@home" --targetServer "confluence210"
--action publishSource --repository "base-cli" --path "src/main/java/org/swift/common/cli/CliClient.java" --title "Example.java" --options "name,lineNumbers,theme=midnight" --replace --space "experiment" --parent "@home" --targetServer "confluence30"
--action publishSource --repository "gint" --owner "gint_org" --path "build.gradle" --title "build.gradle" --replace --space "experiment" --parent "@home" --targetServer "confluence210"
--action publishSource --repository "gint" --owner "gint_org" --path "build.gradle" --title "build.gradle" --replace --space "experiment" --parent "@home" --targetServer "confluence30"

renderRequest

--action renderRequest --url "/2.0/workspaces" --options "pretty"
--action renderRequest --url "https://api.bitbucket.org/2.0/workspaces" --options "pretty"

run

--action run -i "-a getSource --project CLILEGACY --repository base-cli --path src/test/resources/run.txt --file @temp" -i "-a getReplacementVariableList" -i "-a run -f @temp"
--action run -i "-a run -f @bitbucketcloud:2.0/repositories/bobswift/base-cli/src/2ae34c6bc25b69d244709911f4616436eb1e5e20/src/test/resources/run.txt" -i "-a run -f @bitbucketcloud:https://api.bitbucket.org/2.0/repositories/bobswift/base-cli/src/2ae34c6bc25b69d244709911f4616436eb1e5e20/src/test/resources/run.txt"

runFromWorkspaceList

--action runFromWorkspaceList --input "-a getWorkspace --workspace @workspace@ --dateFormat yyyy-MM-dd --outputFormat 2" --input "-a getReplacementVariableList --outputType text"

updateProject

--action updateProject --project "AUT1" --description "Automation Test Project 1 updated" --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"
--action updateProject --project "AUT2" --public --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"
--action updateProject --project "AutomationTestProject2" --description "Automation Test Project 2 updated" --team "{a2b32270-aa52-40e2-9532-d559fa417c8f}"