1
+ name : ' .Platform - Update module registry tables'
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ schedule :
6
+ - cron : " 0 1 * * *" # Daily Update at 1 am
7
+
8
+ env :
9
+ pipelinePrincipalGitUserName : " AVMPipelinePrincipal"
10
+ pipelinePrincipalGitUserEmail :
" [email protected] "
11
+ branch_name : " update-module-features-table"
12
+ pr_title : " Update module features table (automated)"
13
+ pr_body :
14
+ " This is an automated ``pull_request`` containing updates to the module status badges table that is stored at ``docs/content/indexes/bicep/_index.md``, as well as the module features CSV stored at ``docs/static/module-features/bicepFeatures.csv``.\n Please review the ``files changed`` tab to review changes."
15
+
16
+ permissions :
17
+ id-token : write
18
+ contents : write
19
+
20
+ jobs :
21
+ update_status_tables :
22
+ name : Update status tables
23
+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
24
+ runs-on : ubuntu-20.04
25
+ environment : platform
26
+ steps :
27
+ - name : " Checkout"
28
+ uses : actions/checkout@v4
29
+ with :
30
+ fetch-depth : 0
31
+
32
+ - name : Checkout tools repo
33
+ uses : actions/checkout@v4
34
+ with :
35
+ repository : Azure/bicep-registry-modules
36
+ path : bicep-registry-modules
37
+ fetch-depth : 0
38
+
39
+ # - uses: tibdex/github-app-token@v2
40
+ # id: generate-token
41
+ # with:
42
+ # app_id: ${{ secrets.APP_ID }}
43
+ # private_key: ${{ secrets.APP_PRIVATE_KEY }}
44
+
45
+ # - name: Configure local git
46
+ # run: |
47
+ # git config --global user.name '${{ env.pipelinePrincipalGitUserEmail }}'
48
+ # git config --global user.email '${{ env.pipelinePrincipalGitUserName }}'
49
+
50
+ # - name: Create and checkout branch
51
+ # run: |
52
+ # BRANCH_URL="repos/${{ github.repository }}/branches"
53
+ # JQ_FILTER=".[] | select(.name == \"${{ env.branch_name }}\").name"
54
+ # CHECK_BRANCH_ORIGIN=$(gh api $BRANCH_URL | jq -r "$JQ_FILTER")
55
+ # if [ -z "$CHECK_BRANCH_ORIGIN" ]
56
+ # then
57
+ # echo "Checkout local branch (create new, no origin)..."
58
+ # git checkout -b ${{ env.branch_name }}
59
+ # else
60
+ # echo "Checkout local branch (create new, track from origin)..."
61
+ # git checkout -b ${{ env.branch_name }} --track origin/${{ env.branch_name }}
62
+ # fi
63
+ # env:
64
+ # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
65
+
66
+ - name : " Update module status table"
67
+ shell : pwsh
68
+ run : |
69
+ # Load used functions
70
+ . (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'tools' 'platform' 'Set-BicepModuleStatusBadgesTable.ps1')
71
+
72
+ $functionInput = @{
73
+ MarkdownFilePath = Join-Path $env:GITHUB_WORKSPACE 'docs' 'content' 'indexes' 'bicep' '_index.md'
74
+ ModulesRepoRootPath = Join-Path $env:GITHUB_WORKSPACE 'bicep-registry-modules'
75
+ ModulesFolderPath = Join-Path $env:GITHUB_WORKSPACE 'bicep-registry-modules' 'avm' 'res'
76
+ }
77
+
78
+ Write-Verbose "Invoke task with" -Verbose
79
+ Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
80
+
81
+ Set-BicepModuleStatusBadgesTable @functionInput -Verbose
82
+
83
+ - name : " Update module features csv"
84
+ shell : pwsh
85
+ run : |
86
+ # Load used functions
87
+ . (Join-Path $env:GITHUB_WORKSPACE 'utilities' 'tools' 'platform' 'Set-BicepModulesFeatureCSV.ps1')
88
+
89
+ $functionInput = @{
90
+ CSVFilePath = Join-Path $env:GITHUB_WORKSPACE 'docs' 'static' 'module-features' 'bicepFeatures.csv
91
+ ModulesRepoRootPath = Join-Path $env:GITHUB_WORKSPACE 'bicep-registry-modules'
92
+ ModulesFolderPath = Join-Path $env:GITHUB_WORKSPACE 'bicep-registry-modules' 'avm'
93
+ }
94
+
95
+ Write-Verbose "Invoke task with" -Verbose
96
+ Write-Verbose ($functionInput | ConvertTo-Json | Out-String) -Verbose
97
+
98
+ Set-BicepModulesFeatureCSV @functionInput -Verbose
99
+
100
+ # - name: Check for changes
101
+ # id: git_status
102
+ # run: |
103
+ # mapfile -t "CHECK_GIT_STATUS" < <(git status -s)
104
+ # printf "%s\n" "${CHECK_GIT_STATUS[@]}"
105
+ # echo "changes=${#CHECK_GIT_STATUS[@]}" >> "$GITHUB_OUTPUT"
106
+
107
+ # - name: Add files, commit and push
108
+ # if: steps.git_status.outputs.changes > 0
109
+ # run: |
110
+ # echo "Pushing changes to origin..."
111
+ # git add .
112
+ # git commit -m '${{ env.pr_title }}'
113
+ # git push origin ${{ env.branch_name }}
114
+ # env:
115
+ # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
116
+
117
+ # - name: Create pull request
118
+ # if: steps.git_status.outputs.changes > 0
119
+ # run: |
120
+ # HEAD_LABEL="${{ github.repository_owner }}:${{ env.branch_name }}"
121
+ # BASE_LABEL="${{ github.repository_owner }}:$(echo '${{ github.ref }}' | sed 's:refs/heads/::')"
122
+ # PULL_REQUEST_URL="repos/${{ github.repository }}/pulls"
123
+ # JQ_FILTER=".[] | select(.head.label == \"$HEAD_LABEL\") | select(.base.label == \"$BASE_LABEL\") | .url"
124
+ # CHECK_PULL_REQUEST_URL=$(gh api $PULL_REQUEST_URL | jq -r "$JQ_FILTER")
125
+ # if [ -z "$CHECK_PULL_REQUEST_URL" ]
126
+ # then
127
+ # CHECK_PULL_REQUEST_URL=$(gh pr create \
128
+ # --title "${{ env.pr_title }}" \
129
+ # --body "${{ env.pr_body }}" \
130
+ # --base "${{ github.ref }}" \
131
+ # --head "${{ env.branch_name }}")
132
+ # echo "Created new PR: $CHECK_PULL_REQUEST_URL"
133
+ # else
134
+ # echo "Existing PR found: $CHECK_PULL_REQUEST_URL"
135
+ # fi
136
+ # env:
137
+ # GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
138
+
0 commit comments