-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (61 loc) · 2.65 KB
/
capture.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Run - Capture
on:
workflow_dispatch:
inputs:
OUTPUT_FOLDER_PATH:
description: 'Folder where you want to extract the artifacts'
required: true
type: string
default: 'artifacts'
jobs:
capture:
runs-on: ubuntu-latest
environment: dev # change this to match the dev environment created in settings
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Run Capture
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
RESOURCE_GROUP_NAME: ${{ secrets.RESOURCE_GROUP_NAME }}
APIM_INSTANCE_NAME: ${{ secrets.APIM_INSTANCE_NAME }}
OUTPUT_FOLDER_PATH: ${{ github.event.inputs.OUTPUT_FOLDER_PATH }}
run: |
npm install
node ./scripts.v3/capture --subscriptionId "${{ env.AZURE_SUBSCRIPTION_ID }}" --resourceGroupName "${{ env.RESOURCE_GROUP_NAME }}" --serviceName "${{ env.APIM_INSTANCE_NAME }}" --tenantId "${{ env.AZURE_TENANT_ID }}" --servicePrincipal "${{ env.AZURE_CLIENT_ID }}" --servicePrincipalSecret "${{ env.AZURE_CLIENT_SECRET }}" --folder "${{ GITHUB.WORKSPACE }}/${{ env.OUTPUT_FOLDER_PATH }}/snapshot"
shell: pwsh
- name: publish artifact
uses: actions/upload-artifact@v3
env:
OUTPUT_FOLDER_PATH: ${{ github.event.inputs.OUTPUT_FOLDER_PATH }}
with:
name: artifacts-from-capture
path: ${{ GITHUB.WORKSPACE }}/${{ env.OUTPUT_FOLDER_PATH }}
create-pull-request:
needs: capture
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Download Capture artifacts
uses: actions/download-artifact@v3
env:
OUTPUT_FOLDER_PATH: ${{ github.event.inputs.OUTPUT_FOLDER_PATH }}
with:
name: artifacts-from-capture
path: "${{ GITHUB.WORKSPACE }}/${{ env.OUTPUT_FOLDER_PATH }}"
- name: Create artifacts pull request
uses: peter-evans/create-pull-request@v5
env:
OUTPUT_FOLDER_PATH: ${{ github.event.inputs.OUTPUT_FOLDER_PATH }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "updated developer capture to ${{ env.OUTPUT_FOLDER_PATH }}"
title: "${{ env.OUTPUT_FOLDER_PATH }} - dev portal capture"
body: >
This PR is auto-generated by Github actions workflow
labels: extract, automated pr