Last active
September 6, 2022 06:19
-
-
Save therightstuff/212d13348d76de2525f4511154fa06e0 to your computer and use it in GitHub Desktop.
Manual trigger workflow for CircleCI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2.1 | |
parameters: | |
my_trigger_parameter: | |
type: string | |
default: "" | |
workflows: | |
# Workflow triggered by API call / hitting "Trigger Pipeline" in the web interface | |
api-triggered-workflow: | |
when: << pipeline.parameters.my_trigger_parameter >> | |
jobs: | |
- do-the-thing: | |
my_job_param: << pipeline.parameters.my_trigger_parameter >> | |
# Workflow triggered only by pushing a commit to the repository | |
commit-triggered-workflow: | |
when: | |
not: << pipeline.parameters.my_trigger_parameter >> | |
jobs: | |
- do-the-thing | |
jobs: | |
do-the-thing: | |
parameters: | |
my_job_param: | |
type: string | |
default: "triggered by commit" | |
steps: | |
- run: echo << parameters.my_job_param >> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl --location --request POST 'https://circleci.com/api/v2/project/<org slug>/<project slug>/pipeline' \ | |
--header 'Circle-Token: <YOUR CIRCLECI API TOKEN>' \ | |
--header 'Content-Type: application/json' \ | |
--data-raw '{ | |
"branch": "my-branch-name", | |
"parameters": { | |
"my_trigger_parameter": "triggered by API" | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment