Last active
November 5, 2020 21:57
-
-
Save igordrnobrega/f7db022c7e1d54ee4305e05fefa7600c to your computer and use it in GitHub Desktop.
circleci-trigger.fish
This file contains hidden or 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
| #!/usr/bin/env fish | |
| function usage | |
| echo "Triggers a CircleCI workflow." | |
| echo | |
| echo "Usage:" | |
| echo " circleci-trigger <project> <branch>" | |
| echo | |
| echo "Arguments:" | |
| echo " <project> The project in which the workflow will be trigger" | |
| echo " <branch> The branch that will be used for that workflow" | |
| end | |
| set vcs "github" | |
| set organization "credijusto" | |
| set project $argv[1] | |
| set branch $argv[2] | |
| if test -z "$project" || test -z "$branch" | |
| usage | |
| exit 1 | |
| end | |
| curl \ | |
| -H "Circle-Token: $CIRCLE_API_USER_TOKEN" \ | |
| -X POST https://circleci.com/api/v2/project/$vcs/$organization/$project/pipeline \ | |
| -H 'Content-Type: application/json' \ | |
| -H 'Accept: application/json' \ | |
| -H 'x-attribution-login: string' \ | |
| -H 'x-attribution-actor-id: string' \ | |
| -d "{\"branch\":\"$branch\"}" | jq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment