-
Notifications
You must be signed in to change notification settings - Fork 457
104 lines (86 loc) · 4.15 KB
/
platform.updateReadMe.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# NOTE:
# This pipeline requires a secret 'PLATFORM_REPO_UPDATE_PAT' set up in the GitHub secrets.
# The secret's value should be a PAT token with the permissions to push to the repository's main branch.
name: '.Platform: Update ReadMe Module Tables'
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'modules/**/main.bicep'
- 'modules/**/main.json'
- 'utilities/tools/platform/**'
env:
pipelinePrincipalGitUserName: 'CARMLPipelinePrincipal'
pipelinePrincipalGitUserEmail: 'CARML@noreply.github.com'
relativeScriptPath_SetReadMeModuleTable: 'utilities/tools/platform/Set-ReadMeModuleTable.ps1'
relativeScriptPath_SetModuleOverviewTable: 'utilities/tools/platform/Set-ModuleOverviewTable.ps1'
relativeScriptPath_SetReadMePlatformTable: 'utilities/tools/platform/Set-ReadMePlatformTable.ps1'
jobs:
job_update_readme:
runs-on: ubuntu-20.04
name: 'Update status tables'
steps:
- name: 'Checkout'
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ secrets.PLATFORM_REPO_UPDATE_PAT }}' # Sets general GIT credentials up
# Update the root ReadMe Module Pipelines table ([`/README.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- name: 'Update front-page module table'
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetReadMeModuleTable)
$functionInput = @{
ModulesPath = Join-Path $env:GITHUB_WORKSPACE 'modules'
FilePath = Join-Path $env:GITHUB_WORKSPACE 'README.md'
Organization = ($env:GITHUB_REPOSITORY).split('/')[0]
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1]
ColumnsInOrder = @('ProviderNamespace','ResourceType', 'Name', 'Deploy')
Environment = 'GitHub'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ReadMeModuleTable @functionInput -Verbose
# Update the module overview table ([`/docs/wiki/The library - Module overview.md`](https://github.com/Azure/ResourceModules/wiki/The%20library%20-%20Module%20overview))
- name: 'Update module outline'
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetModuleOverviewTable)
$functionInput = @{
MarkdownFilePath = Join-Path $env:GITHUB_WORKSPACE 'docs' 'wiki' 'The library - Module overview.md'
ModuleFolderPath = Join-Path $env:GITHUB_WORKSPACE 'modules'
Organization = ($env:GITHUB_REPOSITORY).split('/')[0]
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1]
Environment = 'GitHub'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ModuleOverviewTable @functionInput -Verbose
# Update the root ReadMe Platform Pipelines table ([`/README.md`](https://github.com/Azure/ResourceModules/blob/main/README.md))
- name: 'Update platform pipelines table'
shell: pwsh
run: |
# Load used functions
. (Join-Path $env:GITHUB_WORKSPACE $env:relativeScriptPath_SetReadMePlatformTable)
$functionInput = @{
FilePath = Join-Path $env:GITHUB_WORKSPACE 'README.md'
RepositoryName = ($env:GITHUB_REPOSITORY).split('/')[1]
Organization = ($env:GITHUB_REPOSITORY).split('/')[0]
Environment = 'GitHub'
}
Write-Verbose "Invoke task with" -Verbose
Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
Set-ReadMePlatformTable @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 add .
git commit -m "Push updated Readme file(s)"
git push