1
1
name : Replace Specs and Snippets
2
2
description : Replaces specs with specs from api-specs repository and code-snippets from api-docs-code-snippets repository
3
- inputs :
4
- branch-name :
3
+ inputs :
4
+ branch-name :
5
5
required : true
6
6
description : Desired Branch Name
7
- username :
7
+ username :
8
8
required : true
9
9
description : Github Username
10
- token :
10
+ token :
11
11
required : true
12
12
description : Github Token
13
13
origin-repo :
@@ -17,71 +17,70 @@ inputs:
17
17
required : true
18
18
description : Origin PR Author
19
19
20
- outputs :
21
- needs_pr :
20
+ outputs :
21
+ needs_pr :
22
22
description : " Whether or not a PR needs to be opened for the corresponding branch"
23
- value : ${{ steps.branch_create.outputs.needs_pr }}
23
+ value : ${{ steps.branch_create.outputs.NEEDS_PR }}
24
24
25
-
26
25
runs :
27
- using : " composite"
28
- steps :
29
- - uses : actions/checkout@v2
30
- with :
31
- token : ${{ inputs.token }}
26
+ using : " composite"
27
+ steps :
28
+ - uses : actions/checkout@v2
29
+ with :
30
+ token : ${{ inputs.token }}
32
31
33
- - name : Create or Checkout Branch
34
- id : branch_create
35
- run : |
36
- git config user.email "[email protected] "
37
- git config user.name ${{ inputs.username }}
38
- if [ "$(git ls-remote --heads https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs.git ${{ inputs.branch-name }} | wc -l)" -eq 1 ]
39
- then
40
- git fetch
41
- git checkout ${{ inputs.branch-name }}
42
- else
43
- git checkout -b ${{ inputs.branch-name }}
44
- echo "::set-output name=needs_pr:: true"
45
- fi
46
- shell : bash
32
+ - name : Create or Checkout Branch
33
+ id : branch_create
34
+ run : |
35
+ git config user.email "[email protected] "
36
+ git config user.name ${{ inputs.username }}
37
+ if [ "$(git ls-remote --heads https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs.git ${{ inputs.branch-name }} | wc -l)" -eq 1 ]
38
+ then
39
+ git fetch
40
+ git checkout ${{ inputs.branch-name }}
41
+ else
42
+ git checkout -b ${{ inputs.branch-name }}
43
+ echo "NEEDS_PR= true" >> $GITHUB_OUTPUT
44
+ fi
45
+ shell : bash
47
46
48
- - name : Copy Api Specs
49
- run : |
50
- mkdir api-specs
51
- if [ ${{ inputs.origin-repo }} = api-specs ]
52
- then
53
- git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
54
- else
55
- git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
56
- fi
57
- rm -r api-specs/.git
58
- cp -TRv api-specs/external site/specs
59
- rm -r api-specs
60
- shell : bash
47
+ - name : Copy Api Specs
48
+ run : |
49
+ mkdir api-specs
50
+ if [ ${{ inputs.origin-repo }} = api-specs ]
51
+ then
52
+ git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
53
+ else
54
+ git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-specs api-specs
55
+ fi
56
+ rm -r api-specs/.git
57
+ cp -TRv api-specs/external site/specs
58
+ rm -r api-specs
59
+ shell : bash
61
60
62
- - name : Copy Code Snippets
63
- run : |
64
- mkdir code-snippets
65
- if [ ${{ inputs.origin-repo }} = api-docs-code-snippets ]
66
- then
67
- git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
68
- else
69
- git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
70
- fi
71
- rm -r code-snippets/.git
72
- mkdir site/code-snippets
73
- cp -TR code-snippets/external site/code-snippets
74
- mv -v code-snippets/add-code-snippets-oas.js code-snippets/package.json code-snippets/env-replace site/code-snippets
75
- rm -r code-snippets
76
- shell : bash
61
+ - name : Copy Code Snippets
62
+ run : |
63
+ mkdir code-snippets
64
+ if [ ${{ inputs.origin-repo }} = api-docs-code-snippets ]
65
+ then
66
+ git clone --branch ${{ inputs.branch-name }} https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
67
+ else
68
+ git clone https://${{ inputs.username }}:${{ inputs.token }}@github.com/Bandwidth/api-docs-code-snippets code-snippets
69
+ fi
70
+ rm -r code-snippets/.git
71
+ mkdir site/code-snippets
72
+ cp -TR code-snippets/external site/code-snippets
73
+ mv -v code-snippets/add-code-snippets-oas.js code-snippets/package.json code-snippets/env-replace site/code-snippets
74
+ rm -r code-snippets
75
+ shell : bash
77
76
78
- - name : Generate Code Snippets
79
- run : |
80
- cd site/code-snippets
81
- npm install
82
- node add-code-snippets-oas.js
83
- cd ..
84
- git add ./specs/*
85
- git commit -m "Add Code Snippets to Spec Files"
86
- git push origin ${{ inputs.branch-name }}
87
- shell : bash
77
+ - name : Generate Code Snippets
78
+ run : |
79
+ cd site/code-snippets
80
+ npm install
81
+ node add-code-snippets-oas.js
82
+ cd ..
83
+ git add ./specs/*
84
+ git commit -m "Add Code Snippets to Spec Files"
85
+ git push origin ${{ inputs.branch-name }}
86
+ shell : bash
0 commit comments