@@ -2,12 +2,8 @@ name: Determine the deployment database name
2
2
description : Geneates the database in which to deploy into
3
3
inputs :
4
4
source-database-name :
5
- description : The root name of the database to copy from (excluding dev, test, prod)
5
+ description : The root name of the database to use (excluding dev, test, prod)
6
6
required : true
7
- include-branch :
8
- description : Whether to include the branch name in the database name
9
- required : false
10
- default : $true
11
7
outputs :
12
8
database-name :
13
9
description : The name of the database to use for deployment
@@ -16,35 +12,22 @@ runs:
16
12
using : " composite"
17
13
steps :
18
14
- name : Get branch name (merge)
19
- if : github.event_name != 'pull_request' && ${{ inputs.include-branch }}
15
+ if : github.event_name != 'pull_request'
20
16
shell : bash
21
17
run : |
22
18
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
23
19
24
20
- name : Get branch name (pull request)
25
- if : github.event_name == 'pull_request' && ${{ inputs.include-branch }}
21
+ if : github.event_name == 'pull_request'
26
22
shell : bash
27
23
run : |
28
24
echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
29
25
30
- - name : Determine new database name with branch attached
31
- if : ${{ inputs.include-branch }}
32
- shell : bash
33
- run : |
34
- echo "DATABASE_NAME=$(echo ${{ inputs.source-database-name }}_${{ env.BRANCH_NAME }}.toUpperCase() | tr / -)" >> $GITHUB_ENV
35
-
36
- - name : Determine new database name with no branch
37
- if : ${{ inputs.include-branch }} == $false
38
- shell : bash
39
- run : |
40
- echo "DATABASE_NAME=$(echo ${{ inputs.source-database-name }} | tr / -)" >> $GITHUB_ENV
41
-
42
26
- name : BRANCH_NAME
43
27
id : determine-database-name
44
28
shell : bash
45
29
run : |
46
- echo "::set-output name=database-name::${{ env.DATABASE_NAME }}"
47
-
30
+ echo "::set-output name=database-name::$(echo ${{ inputs.source-database-name }}_${{ env.BRANCH_NAME }} | tr a-z A-Z)"
48
31
49
32
- name : show target name
50
33
shell : bash
0 commit comments