@@ -38,6 +38,7 @@ run-name: ${{ github.workflow }}${{ inputs.distinct_id && format(' (bot run {0})
3838
3939permissions :
4040 contents : read
41+ id-token : write
4142
4243# Ensure scripts are run with pipefail. See:
4344# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference
@@ -48,13 +49,16 @@ defaults:
4849jobs :
4950 build :
5051 runs-on : ubuntu-latest
52+ environment :
53+ name : azure
54+ deployment : false
5155
5256 steps :
5357 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5458 with :
5559 filter : blob:none # https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
5660 fetch-depth : 0 # Default is 1; need to set to 0 to get the benefits of blob:none.
57- token : ${{ secrets.TS_BOT_GITHUB_TOKEN }}
61+ persist-credentials : false
5862 - uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
5963 with :
6064 node-version : ' lts/*'
@@ -85,14 +89,39 @@ jobs:
8589 git config user.email "typescriptbot@microsoft.com"
8690 git config user.name "TypeScript Bot"
8791 git commit -m "Bump version to $PACKAGE_VERSION and LKG"
88- git push --set-upstream origin "$BRANCH_NAME"
92+ - uses : azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0
93+ with :
94+ client-id : ${{ vars.AZURE_CLIENT_ID }}
95+ tenant-id : ${{ vars.AZURE_TENANT_ID }}
96+ subscription-id : ${{ vars.AZURE_SUBSCRIPTION_ID }}
97+ - name : Create GitHub App token
98+ id : app-token
99+ uses : microsoft/create-github-app-token-via-key-vault@5ba0d436e9c3cac52feff4d1f2f66f9698ce4a2d # v1
100+ with :
101+ client-id : ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_CLIENT_ID }}
102+ key-id : ${{ vars.TYPESCRIPT_AUTOMATION_GITHUB_APP_KEY_ID }}
103+ owner : microsoft
104+ repositories : TypeScript
105+ permission-contents : write
106+ - name : Configure git for GitHub App token
107+ shell : bash
108+ env :
109+ GITHUB_APP_TOKEN : ${{ steps.app-token.outputs.token }}
110+ run : |
111+ set -euo pipefail
112+ basic_auth="$(node -e 'process.stdout.write(Buffer.from("x-access-token:" + process.env.GITHUB_APP_TOKEN).toString("base64"))')"
113+ echo "::add-mask::$basic_auth"
114+ git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${basic_auth}"
115+ - env :
116+ BRANCH_NAME : ${{ inputs.branch_name }}
117+ run : git push --set-upstream origin "$BRANCH_NAME"
89118
90119 - uses : microsoft/typescript-bot-test-triggerer/.github/actions/post-workflow-result@master
91120 if : ${{ !cancelled() && inputs.distinct_id }}
92121 with :
93122 success_comment : " I've created ${{ inputs.branch_name }} with version ${{ inputs.package_version }} for you."
94123 failure_comment : ' I was unable to create the new release branch.'
95- github_token : ${{ secrets.TS_BOT_GITHUB_TOKEN }}
124+ github_token : ${{ steps.app-token.outputs.token }}
96125 distinct_id : ${{ inputs.distinct_id }}
97126 source_issue : ${{ inputs.source_issue }}
98127 requesting_user : ${{ inputs.requesting_user }}
0 commit comments