@@ -109,13 +109,41 @@ jobs:
109109 tenant-id : ${{ secrets.AZURE_COMMON_VAULT_TENANT_ID }}
110110 subscription-id : ${{ secrets.AZURE_COMMON_VAULT_SUBSCRIPTION_ID }}
111111
112- - name : Setup secrets
113- id : secrets
112+ - name : Get secrets from vault
113+ uses : nginx/ci-self-hosted/.github/actions/get-from-vault@5c3e1f8b51f66a851fdba80f70e19cf966199730 # main @ 2026-05-22
114+ with :
115+ vault-name : ${{ secrets.COMMON_KEYVAULT_NAME }}
116+ secret-names : " nginx-bot-nic-create-pr-app-client-id, nginx-bot-nic-create-pr-app-private-key"
117+ env-names : " APP_CLIENT_ID, APP_PRIVATE_KEY_B64"
118+
119+ - name : Decode GitHub App private key
120+ id : app_key
114121 run : |
115- echo "Setting secrets for job"
116- NGINX_PAT=$(az keyvault secret show --name nginx-bot-pat --vault-name ${{ secrets.COMMON_KEYVAULT_NAME }} --query value -o tsv)
117- echo "::add-mask::$NGINX_PAT"
118- echo "NGINX_PAT=$NGINX_PAT" >> $GITHUB_OUTPUT
122+ set +x
123+ # Mask the raw base64 value
124+ echo "::add-mask::$APP_PRIVATE_KEY_B64"
125+ private_key=$(printf '%s' "$APP_PRIVATE_KEY_B64" | base64 -d)
126+ # Mask every line of the decoded PEM key individually
127+ while IFS= read -r line; do
128+ if [[ -n "$line" ]]; then
129+ echo "::add-mask::$line"
130+ fi
131+ done <<< "$private_key"
132+ delimiter="GHEOF_$(openssl rand -hex 12)"
133+ {
134+ echo "private_key<<$delimiter"
135+ echo "$private_key"
136+ echo "$delimiter"
137+ } >> "$GITHUB_OUTPUT"
138+
139+ - name : Generate GitHub App token
140+ id : app_token
141+ uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
142+ with :
143+ client-id : ${{ env.APP_CLIENT_ID }}
144+ private-key : ${{ steps.app_key.outputs.private_key }}
145+ owner : ${{ github.repository_owner }}
146+ repositories : ${{ github.event.repository.name }}
119147
120148 - name : Generate secrets for snapshot tests
121149 run : |
@@ -155,7 +183,7 @@ jobs:
155183 - name : Create Pull Request
156184 uses : peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
157185 with :
158- token : ${{ steps.secrets .outputs.NGINX_PAT }}
186+ token : ${{ steps.app_token .outputs.token }}
159187 commit-message : Release ${{ steps.parse.outputs.new_version }}
160188 title : Release ${{ steps.parse.outputs.new_version }}
161189 branch : docs/release-${{ steps.parse.outputs.new_version }}
@@ -206,13 +234,41 @@ jobs:
206234 tenant-id : ${{ secrets.AZURE_COMMON_VAULT_TENANT_ID }}
207235 subscription-id : ${{ secrets.AZURE_COMMON_VAULT_SUBSCRIPTION_ID }}
208236
209- - name : Setup secrets
210- id : secrets
237+ - name : Get secrets from vault
238+ uses : nginx/ci-self-hosted/.github/actions/get-from-vault@5c3e1f8b51f66a851fdba80f70e19cf966199730 # main @ 2026-05-22
239+ with :
240+ vault-name : ${{ secrets.COMMON_KEYVAULT_NAME }}
241+ secret-names : " nginx-bot-nic-create-pr-app-client-id, nginx-bot-nic-create-pr-app-private-key"
242+ env-names : " APP_CLIENT_ID, APP_PRIVATE_KEY_B64"
243+
244+ - name : Decode GitHub App private key
245+ id : app_key
211246 run : |
212- echo "Setting secrets for job"
213- NGINX_PAT=$(az keyvault secret show --name nginx-bot-pat --vault-name ${{ secrets.COMMON_KEYVAULT_NAME }} --query value -o tsv)
214- echo "::add-mask::$NGINX_PAT"
215- echo "NGINX_PAT=$NGINX_PAT" >> $GITHUB_OUTPUT
247+ set +x
248+ # Mask the raw base64 value
249+ echo "::add-mask::$APP_PRIVATE_KEY_B64"
250+ private_key=$(printf '%s' "$APP_PRIVATE_KEY_B64" | base64 -d)
251+ # Mask every line of the decoded PEM key individually
252+ while IFS= read -r line; do
253+ if [[ -n "$line" ]]; then
254+ echo "::add-mask::$line"
255+ fi
256+ done <<< "$private_key"
257+ delimiter="GHEOF_$(openssl rand -hex 12)"
258+ {
259+ echo "private_key<<$delimiter"
260+ echo "$private_key"
261+ echo "$delimiter"
262+ } >> "$GITHUB_OUTPUT"
263+
264+ - name : Generate GitHub App token
265+ id : app_token
266+ uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
267+ with :
268+ client-id : ${{ env.APP_CLIENT_ID }}
269+ private-key : ${{ steps.app_key.outputs.private_key }}
270+ owner : ${{ github.repository_owner }}
271+ repositories : " ${{ github.event.repository.name }},documentation"
216272
217273 - name : Update Documentation Versions
218274 run : |
@@ -230,6 +286,6 @@ jobs:
230286 env :
231287 GITHUB_USERNAME : nginx-bot
232288 GITHUB_EMAIL : integrations@nginx.com
233- GITHUB_TOKEN : ${{ steps.secrets .outputs.NGINX_PAT }}
289+ GITHUB_TOKEN : ${{ steps.app_token .outputs.token }}
234290 DRY_RUN : ${{ inputs.dry_run && 'true' || 'false' }}
235291 DEBUG : ${{ inputs.debug && 'true' || 'false' }}
0 commit comments