Skip to content

Commit

Permalink
add gcp region to actions inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
gpmayorga committed Jan 26, 2024
1 parent 69147cb commit 015e713
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions .github/actions/discover_function/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
GSA:
required: true
description: Github Servicer Account
GCP_REGION:
required: true
description: Google Cloud region for the function
outputs:
function_url:
description: "the discovered URL"
Expand Down Expand Up @@ -38,7 +41,7 @@ runs:
echo "Called from website job, keep searching for function"
max_retry=7
counter=0
while ! gcloud functions describe --region ${{ vars.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} 1> /dev/null &&
while ! gcloud functions describe --region ${{ inputs.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} 1> /dev/null &&
[ ${counter} -lt ${max_retry} ]
do
echo " Function not found - Try #${counter}"
Expand All @@ -49,9 +52,9 @@ runs:
counter=$((counter+1))
done
if ! gcloud functions describe --region ${{ vars.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} &> /dev/null; then
if ! gcloud functions describe --region ${{ inputs.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} &> /dev/null; then
echo "::error title=Not_found::Function ${{ steps.deploy_vars.outputs.function_name }} not found, check functions deploy and re-run this job"
exit 1
else
echo "url=$(gcloud functions describe --region ${{ vars.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} --format='value(httpsTrigger.url)')" >> $GITHUB_OUTPUT
echo "url=$(gcloud functions describe --region ${{ inputs.GCP_REGION }} ${{ steps.deploy_vars.outputs.function_name }} --format='value(httpsTrigger.url)')" >> $GITHUB_OUTPUT
fi
3 changes: 2 additions & 1 deletion .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ jobs:
uses: ./.github/actions/discover_function
with:
GWIP: ${{ secrets.GWIP }}
GSA: ${{ secrets.GSA }}
GSA: ${{ secrets.GSA }}
GCP_REGION: ${{ vars.GCP_REGION }}

- name: Build
env:
Expand Down

0 comments on commit 015e713

Please sign in to comment.