4
4
issue_comment :
5
5
types : [created]
6
6
7
+ env :
8
+ pscale_base_directory : .pscale
9
+
10
+
7
11
jobs :
8
12
prechecks :
9
13
name : Permission pre-check
@@ -112,7 +116,8 @@ jobs:
112
116
id : get-ps-env
113
117
env :
114
118
REF : ${{ needs.prechecks.outputs.ref }}
115
- run : .pscale/ps-env-${REF}.sh
119
+ working-directory : ${{env.pscale_base_directory}}
120
+ run : env/ps-env-${REF}.sh
116
121
117
122
- name : Acknowledge /ps-merge request with context
118
123
id : acknowledge
@@ -188,9 +193,9 @@ jobs:
188
193
PLANETSCALE_SERVICE_TOKEN : ${{secrets.PLANETSCALE_SERVICE_TOKEN}}
189
194
GITHUB_USER : ${{github.actor}}
190
195
REF : ${{ needs.prechecks.outputs.ref }}
191
-
196
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
192
197
run : |
193
- . .pscale /ps-env-${REF}.sh && ./merge-deploy-request.sh $DEPLOY_REQUEST_NUMBER
198
+ . ../env /ps-env-${REF}.sh && ./merge-deploy-request.sh $DEPLOY_REQUEST_NUMBER
194
199
195
200
- name : Schema change merge succeeded
196
201
id : merging-succeeded
@@ -215,7 +220,7 @@ jobs:
215
220
deployment_id: deployment_id,
216
221
state: 'success',
217
222
description: 'Schema changes merged successfully from branch ' + BRANCH_NAME + ' :tada:',
218
- target_url : DEPLOY_REQUEST_URL,
223
+ environment_url : DEPLOY_REQUEST_URL,
219
224
log_url: log_url
220
225
})
221
226
@@ -330,11 +335,12 @@ jobs:
330
335
env :
331
336
REF : ${{ needs.prechecks.outputs.ref }}
332
337
comment : ${{ github.event.comment.body }}
338
+ baseDirectory : ${{env.pscale_base_directory}}
333
339
uses : actions/github-script@v3
334
340
with :
335
341
github-token : ${{ secrets.GITHUB_TOKEN }}
336
342
script : |
337
- const { REF, comment } = process.env;
343
+ const { REF, comment, baseDirectory } = process.env;
338
344
339
345
// check if comment starts with '/ps-create' and is only followed by whitespaces
340
346
const regexCommandWithoutParameters = /^\/ps-create\s*$/
@@ -375,7 +381,7 @@ jobs:
375
381
core.info("DDL statements: " + DDL_STATEMENTS)
376
382
core.setOutput('DDL_STATEMENTS', DDL_STATEMENTS)
377
383
378
- const ps_env_name = '.pscale /ps-env-' + REF + ".sh"
384
+ const ps_env_name = baseDirectory + '/env /ps-env-' + REF + ".sh"
379
385
// check whether file ps_env_name exists in the repo and given ref
380
386
try {
381
387
const response = await github.repos.getContent({
@@ -425,6 +431,7 @@ jobs:
425
431
GITHUB_USER : ${{github.actor}}
426
432
DDL_STATEMENTS : ${{ steps.validate_params.outputs.DDL_STATEMENTS }}
427
433
BRANCH_NAME : ${{ steps.validate_params.outputs.BRANCH_NAME }}
434
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
428
435
run : |
429
436
./create-db-branch-dr-and-connection.sh "$BRANCH_NAME" "$DDL_STATEMENTS"
430
437
@@ -437,10 +444,11 @@ jobs:
437
444
DEPLOY_REQUEST_NUMBER : ${{ steps.create-db-branch-and-dr.outputs.DEPLOY_REQUEST_NUMBER }}
438
445
DEPLOY_REQUEST_URL : ${{ steps.create-db-branch-and-dr.outputs.DEPLOY_REQUEST_URL }}
439
446
BRANCH_URL : ${{ steps.create-db-branch-and-dr.outputs.BRANCH_URL }}
447
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
440
448
run : |
441
- mkdir -p .pscale /
442
- envsubst < ps-env-template.sh > .pscale/ ps-env-${REF }.sh
443
- chmod a+x .pscale /ps-env-${REF}.sh
449
+ mkdir -p ../env /
450
+ envsubst < ps-env-template.sh > ../env/ ps-env-${BRANCH_NAME }.sh
451
+ chmod a+x ../env /ps-env-${REF}.sh
444
452
445
453
- name : Commit changes
446
454
uses : elstudio/actions-js-build/commit@v4
@@ -564,11 +572,12 @@ jobs:
564
572
env :
565
573
REF : ${{ needs.prechecks.outputs.ref }}
566
574
comment : ${{ github.event.comment.body }}
575
+ baseDirectory : ${{env.pscale_base_directory}}
567
576
uses : actions/github-script@v3
568
577
with :
569
578
github-token : ${{ secrets.GITHUB_TOKEN }}
570
579
script : |
571
- const { REF, comment } = process.env;
580
+ const { REF, comment, baseDirectory } = process.env;
572
581
573
582
// check if comment starts with '/ps-update' and is only followed by whitespaces
574
583
const regexCommandWithoutParameters = /^\/ps-update\s*$/
@@ -596,7 +605,7 @@ jobs:
596
605
core.info("DDL statements: " + DDL_STATEMENTS)
597
606
core.setOutput('DDL_STATEMENTS', DDL_STATEMENTS)
598
607
599
- const ps_env_name = '.pscale /ps-env-' + REF + ".sh"
608
+ const ps_env_name = baseDirectory + '/env /ps-env-' + REF + ".sh"
600
609
// check whether file ps_env_name exists in the repo and given ref
601
610
try {
602
611
const response = await github.repos.getContent({
@@ -643,7 +652,8 @@ jobs:
643
652
REF : ${{ needs.prechecks.outputs.ref }}
644
653
GITHUB_USER : ${{github.actor}}
645
654
DDL_STATEMENTS : ${{ steps.validate_params.outputs.DDL_STATEMENTS }}
646
- run : . .pscale/ps-env-${REF}.sh && ./update-db-branch.sh "$BRANCH_NAME" "$DDL_STATEMENTS" "$DEPLOY_REQUEST_NUMBER"
655
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
656
+ run : . ../env/ps-env-${REF}.sh && ./update-db-branch.sh "$BRANCH_NAME" "$DDL_STATEMENTS" "$DEPLOY_REQUEST_NUMBER"
647
657
648
658
- name : Database branch and DR update succeeded
649
659
id : ps-update-succeeded
@@ -761,11 +771,12 @@ jobs:
761
771
env :
762
772
REF : ${{ needs.prechecks.outputs.ref }}
763
773
comment : ${{ github.event.comment.body }}
774
+ baseDirectory : ${{env.pscale_base_directory}}
764
775
uses : actions/github-script@v3
765
776
with :
766
777
github-token : ${{ secrets.GITHUB_TOKEN }}
767
778
script : |
768
- const { REF, comment } = process.env;
779
+ const { REF, comment, baseDirectory } = process.env;
769
780
770
781
reviewComment = "LGTM"
771
782
@@ -790,7 +801,7 @@ jobs:
790
801
791
802
core.setOutput('reviewComment', reviewComment)
792
803
793
- const ps_env_name = '.pscale /ps-env-' + REF + ".sh"
804
+ const ps_env_name = baseDirectory + '/env /ps-env-' + REF + ".sh"
794
805
// check whether file ps_env_name exists in the repo and given ref
795
806
try {
796
807
const response = await github.repos.getContent({
@@ -837,7 +848,8 @@ jobs:
837
848
REF : ${{ needs.prechecks.outputs.ref }}
838
849
GITHUB_USER : ${{github.actor}}
839
850
COMMENT : ${{steps.validate_params.outputs.reviewComment}}
840
- run : . .pscale/ps-env-${REF}.sh && ./approve-deploy-request.sh "$DEPLOY_REQUEST_NUMBER" "$COMMENT"
851
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
852
+ run : . ../env/ps-env-${REF}.sh && ./approve-deploy-request.sh "$DEPLOY_REQUEST_NUMBER" "$COMMENT"
841
853
842
854
- name : Approved deploy request
843
855
id : ps-approve-succeeded
@@ -935,11 +947,12 @@ jobs:
935
947
env :
936
948
REF : ${{ needs.prechecks.outputs.ref }}
937
949
comment : ${{ github.event.comment.body }}
950
+ baseDirectory : ${{ env.pscale_base_directory }}
938
951
uses : actions/github-script@v3
939
952
with :
940
953
github-token : ${{ secrets.GITHUB_TOKEN }}
941
954
script : |
942
- const { REF, comment } = process.env;
955
+ const { REF, comment, baseDirectory } = process.env;
943
956
944
957
// check if comment starts with '/ps-delete' and is only followed by whitespaces
945
958
const regexCommandWithoutParameters = /^\/ps-delete\s*$/
@@ -953,7 +966,7 @@ jobs:
953
966
throw new Error(message)
954
967
}
955
968
956
- const ps_env_name = '.pscale /ps-env-' + REF + ".sh"
969
+ const ps_env_name = baseDirectory + '/env /ps-env-' + REF + ".sh"
957
970
// check whether file ps_env_name exists in the repo and given ref
958
971
try {
959
972
const response = await github.repos.getContent({
@@ -999,7 +1012,8 @@ jobs:
999
1012
PLANETSCALE_SERVICE_TOKEN : ${{secrets.PLANETSCALE_SERVICE_TOKEN}}
1000
1013
REF : ${{ needs.prechecks.outputs.ref }}
1001
1014
GITHUB_USER : ${{github.actor}}
1002
- run : . .pscale/ps-env-${REF}.sh && ./delete-db-branch.sh "$BRANCH_NAME"
1015
+ working-directory : ${{env.pscale_base_directory}}/cli-helper-scripts/
1016
+ run : . ../env/ps-env-${REF}.sh && ./delete-db-branch.sh "$BRANCH_NAME"
1003
1017
1004
1018
- name : Database branch deleted
1005
1019
id : ps-delete-succeeded
0 commit comments