Skip to content

Commit adc411e

Browse files
author
Bot
committed
auto update db cache in preview app
1 parent 708543c commit adc411e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/main-workflow.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
[[ "${{ steps.changes.outputs.files }}" =~ package\.json ]] && echo "package_json=true" >> $GITHUB_ENV;
4141
[[ "${{ steps.changes.outputs.files }}" =~ \.github/|actions/ ]] && echo "github_actions=true" >> $GITHUB_ENV;
4242
[[ "${{ contains(github.event.head_commit.message, '[Code submission]') }}" == "true" || "${{ contains(github.head_ref, 'code-submission') }}" == "true" ]] && echo "code_submission=true" >> $GITHUB_ENV;
43+
$pull_request && echo "heroku_review_app_url=https://coderush-pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH").herokuapp.com" >> $GITHUB_ENV;
4344
exit 0;
4445
- name: 'Setup other env variables'
4546
# env variables are available only in next steps
@@ -55,7 +56,7 @@ jobs:
5556
echo "github_actions=$github_actions";
5657
echo "all=$all";
5758
echo "code_submission=$code_submission";
58-
echo "commit_msg=${{ github.event.head_commit.message }}";
59+
echo "heroku_review_app_url=$heroku_review_app_url";
5960
echo "base_ref=${{ github.base_ref }}";
6061
echo "head_ref=${{ github.head_ref }}";
6162
@@ -81,7 +82,7 @@ jobs:
8182
- name: Set API URL for testing
8283
if: (env.all || env.frontend) && !env.live
8384
run: |
84-
echo "VUE_APP_API_URL=https://coderush-pr-$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH").herokuapp.com" > .env.production
85+
echo "VUE_APP_API_URL=$HEROKU_REVIEW_APP_URL" > .env.production
8586
- name: Vue build
8687
if: env.all || env.frontend
8788
run: |
@@ -130,14 +131,14 @@ jobs:
130131
- name: Accept code submission
131132
if: env.code_submission && env.live
132133
run: |
133-
node actions/add-code-submission-to-db.js && curl -X POST ${{ secrets.DB_CACHE_UPDATE_URL }}
134+
node actions/add-code-submission-to-db.js && curl -X POST https://api.coderush.xyz${{ secrets.DB_CACHE_UPDATE_URL }}
134135
env:
135136
TOKEN: ${{ secrets.GITHUB_TOKEN }}
136137
FAUNA_KEY: ${{ secrets.FAUNA_KEY }}
137138
- name: Accept code submission on dev database
138139
if: env.code_submission && !env.live
139140
run: |
140-
node actions/add-code-submission-to-db.js
141+
node actions/add-code-submission-to-db.js && curl -X POST $heroku_review_app_url${{ secrets.DB_CACHE_UPDATE_URL }}
141142
env:
142143
TOKEN: ${{ secrets.GITHUB_TOKEN }}
143144
FAUNA_KEY: ${{ secrets.FAUNA_DEV_KEY }}

0 commit comments

Comments
 (0)