File tree Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Expand file tree Collapse file tree 2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -115,3 +115,38 @@ jobs:
115115 CF_NAME : projects/${{ secrets.DEPLOY_CF_PROJECT_ID }}/locations/us-east1/functions/cf-http-json-${{ github.run_number }}
116116 CF_REGION : us-east1
117117
118+ json-event-trigger :
119+ name : test event trigger
120+ runs-on : ubuntu-latest
121+ steps :
122+ - uses : actions/checkout@v2
123+ - id : build
124+ name : Build dist
125+ run : |-
126+ npm install
127+ npm run build
128+ - id : deploy
129+ uses : ./
130+ with :
131+ name : cf-event-json-${{ github.run_number }}
132+ runtime : nodejs10
133+ entry_point : helloWorld
134+ source_dir : ./tests/test-node-func/
135+ credentials : ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
136+ event_trigger_type : providers/cloud.pubsub/eventTypes/topic.publish
137+ event_trigger_resource : ${{ secrets.DEPLOY_CF_EVENT_PUBSUB_TOPIC }}
138+ - uses : actions/setup-node@master
139+ with :
140+ node-version : 12.x
141+ - run : npm install
142+ - uses : google-github-actions/setup-gcloud@master # Set up ADC to make authenticated request to service
143+ with :
144+ service_account_email : ${{ secrets.DEPLOY_CF_SA_EMAIL }}
145+ service_account_key : ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
146+ export_default_credentials : true
147+ - name : integration test clean up
148+ run : npm run cleanup
149+ env :
150+ DEPLOY_CF_SA_KEY_JSON : ${{ secrets.DEPLOY_CF_SA_KEY_JSON }}
151+ CF_NAME : projects/${{ secrets.DEPLOY_CF_PROJECT_ID }}/locations/us-central1/functions/cf-event-json-${{ github.run_number }}
152+
Original file line number Diff line number Diff line change @@ -60,8 +60,12 @@ async function run(): Promise<void> {
6060 // Deploy function
6161 const deployFunctionResponse = await client . deploy ( newFunc ) ;
6262
63- // Set Cloud Function URL as output
64- core . setOutput ( 'url' , deployFunctionResponse . response ?. httpsTrigger . url ) ;
63+ if ( deployFunctionResponse . response ?. httpsTrigger ?. url ) {
64+ // Set Cloud Function URL as output
65+ core . setOutput ( 'url' , deployFunctionResponse . response . httpsTrigger . url ) ;
66+ } else {
67+ core . info ( 'No URL set. Only HttpsTrigger Cloud Functions have URL.' ) ;
68+ }
6569 } catch ( error ) {
6670 core . setFailed ( error . message ) ;
6771 }
You can’t perform that action at this time.
0 commit comments