-
Notifications
You must be signed in to change notification settings - Fork 454
74 lines (61 loc) · 2.21 KB
/
platform.apiSpecs.yml
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
69
70
71
72
73
74
name: ".Platform: Update API Specs file"
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * 0" # Weekly Sunday Update
env:
pipelinePrincipalGitUserName: "CARMLPipelinePrincipal"
pipelinePrincipalGitUserEmail: "[email protected]"
jobs:
job_update_api_specs_file:
name: "Update file"
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.PLATFORM_REPO_UPDATE_PAT }}" # Sets general GIT credentials up
# [Setup] task(s)
# ---------------
- name: "Setup agent"
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'pipelines' 'sharedScripts' 'Set-EnvironmentOnAgent.ps1')
# Define PS modules to install on the runner
$modules = @(
@{ Name = 'Az.Accounts' },
@{ Name = 'Az.Resources' }
)
# Set agent up
Set-EnvironmentOnAgent -PSModules $modules
- name: Azure Login
uses: Azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
- name: "Update file"
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'tools' 'platform' 'Set-ApiSpecsFile.ps1')
$functionInput = @{
SpecsFilePath = Join-Path $env:GITHUB_WORKSPACE 'utilities' 'src' 'apiSpecsList.json'
IncludePreview = $true
IncludeExternalSources = $true
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ApiSpecsFile @functionInput -Verbose
- name: "Push changes"
shell: pwsh
run: |
git config --global user.email '${{ env.pipelinePrincipalGitUserEmail }}'
git config --global user.name '${{ env.pipelinePrincipalGitUserName }}'
git pull
git status
git add .
git commit -m 'Push updated API Specs file'
git push