|
3 | 3 | workflow_dispatch: |
4 | 4 | inputs: |
5 | 5 | branch_name: |
6 | | - description: 'Release target branch name' |
| 6 | + description: 'Type a branch name starting with `release/v`' |
7 | 7 | required: true |
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | trigger-release-ticket-creation: |
11 | 11 | name: Trigger release ticket creation |
12 | 12 | runs-on: ubuntu-latest |
13 | | - # The branch name should starts with 'release/v' |
14 | | - if: startsWith(github.event.inputs.branch_name, 'release/v') |
15 | 13 | steps: |
16 | 14 | - name: Checkout repository |
17 | 15 | uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Verify branch name |
| 18 | + run: | |
| 19 | + if [[ ! ${{ github.event.inputs.branch_name }} =~ ^release/v ]]; then |
| 20 | + echo "Branch name should start with 'release/v'" |
| 21 | + exit 1 |
| 22 | + fi |
| 23 | +
|
18 | 24 | - name: Trigger CircleCI Job |
19 | 25 | run: | |
20 | 26 | API_RESULT=$(curl --request POST \ |
21 | 27 | --url "https://circleci.com/api/v2/project/gh/${{ github.repository }}/pipeline" \ |
22 | | - --header "Circle-Token: ${{ secrets.CIRCLE_CI_API_TOKEN }}" \ |
| 28 | + --header "Circle-Token: ${{ secrets.CIRCLECI_API_TOKEN }}" \ |
23 | 29 | --header "content-type: application/json" \ |
24 | 30 | --data '{ |
25 | 31 | "branch": "${{ github.event.inputs.branch_name }}", |
26 | 32 | "parameters": { |
27 | | - "run_workflow_create_ticket": true, |
| 33 | + "run_workflow_create_ticket": true |
28 | 34 | } |
29 | 35 | }') |
30 | 36 | echo "API_RESULT: ${API_RESULT}" |
31 | 37 | CIRCLE_CI_JOB_NUMBER=$(echo "${API_RESULT}" | jq -r '.number') |
32 | 38 | echo "::set-output name=DEPLOY_COMMENT_BODY::https://app.circleci.com/pipelines/github/${{ github.repository }}/$CIRCLE_CI_JOB_NUMBER" |
33 | | - env: |
34 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
35 | | - CIRCLE_CI_API_TOKEN: ${{ secrets.CIRCLE_CI_API_TOKEN }} |
|
0 commit comments