@@ -29,7 +29,8 @@ permissions:
2929jobs :
3030 automation :
3131 uses : ./.github/workflows/automation.yml
32- secrets : inherit
32+ secrets :
33+ OTELBOT_DOTNET_PRIVATE_KEY : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
3334
3435 prepare-release-pr :
3536 runs-on : ubuntu-22.04
@@ -38,18 +39,22 @@ jobs:
3839
3940 if : github.event_name == 'workflow_dispatch' && needs.automation.outputs.enabled
4041
41- env :
42- GH_TOKEN : ${{ secrets[needs.automation.outputs.token-secret-name] }}
43-
4442 steps :
43+ - uses : actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
44+ id : otelbot-token
45+ with :
46+ app-id : ${{ vars.OTELBOT_DOTNET_APP_ID }}
47+ private-key : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
48+
4549 - name : Check out code
4650 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4751 with :
48- token : ${{ env.GH_TOKEN }}
52+ token : ${{ steps.otelbot-token.outputs.token }}
4953
5054 - name : Create GitHub Pull Request to prepare release
5155 shell : pwsh
5256 env :
57+ GH_TOKEN : ${{ steps.otelbot-token.outputs.token }}
5358 BOT_USER_EMAIL : ${{ needs.automation.outputs.email }}
5459 BOT_USER_NAME : ${{ needs.automation.outputs.username }}
5560 COMMENT_USER_NAME : ${{ github.event.sender.login }}
@@ -75,32 +80,36 @@ jobs:
7580 if : |
7681 github.event_name == 'pull_request' &&
7782 github.event.action == 'closed' &&
78- github.event.pull_request.user.login == needs.automation.outputs.username &&
83+ github.event.pull_request.user.login == needs.automation.outputs.application- username &&
7984 github.event.pull_request.merged == true &&
8085 startsWith(github.event.pull_request.title, '[release] Prepare release ') &&
8186 needs.automation.outputs.enabled
8287
83- env :
84- GH_TOKEN : ${{ secrets[needs.automation.outputs.token-secret-name] }}
85-
8688 steps :
89+ - uses : actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
90+ id : otelbot-token
91+ with :
92+ app-id : ${{ vars.OTELBOT_DOTNET_APP_ID }}
93+ private-key : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
94+
8795 - name : Check out code
8896 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
8997 with :
90- token : ${{ env.GH_TOKEN }}
98+ token : ${{ steps.otelbot-token.outputs.token }}
9199
92100 - name : Lock GitHub Pull Request to prepare release
93101 shell : pwsh
94102 env :
95- BOT_USER_NAME : ${{ needs.automation.outputs.username }}
103+ GH_TOKEN : ${{ steps.otelbot-token.outputs.token }}
104+ EXPECTED_PR_AUTHOR_USER_NAME : ${{ needs.automation.outputs.application-name }}
96105 ISSUE_NUMBER : ${{ github.event.pull_request.number }}
97106 run : |
98107 Import-Module .\build\scripts\prepare-release.psm1
99108
100109 LockPullRequestAndPostNoticeToCreateReleaseTag `
101110 -gitRepository ${env:GITHUB_REPOSITORY} `
102111 -pullRequestNumber ${env:ISSUE_NUMBER} `
103- -botUserName ${env:BOT_USER_NAME }
112+ -expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME }
104113
105114 create-release-tag-pr-post-notice :
106115 runs-on : ubuntu-22.04
@@ -111,37 +120,42 @@ jobs:
111120 github.event_name == 'issue_comment' &&
112121 github.event.issue.pull_request &&
113122 github.event.issue.locked == true &&
114- github.event.comment.user.login != needs.automation.outputs.username &&
123+ github.event.comment.user.login != needs.automation.outputs.application- username &&
115124 contains(github.event.comment.body, '/CreateReleaseTag') &&
116125 startsWith(github.event.issue.title, '[release] Prepare release ') &&
117126 github.event.issue.pull_request.merged_at &&
118127 needs.automation.outputs.enabled
119128
120- env :
121- GH_TOKEN : ${{ secrets[needs.automation.outputs.token-secret-name] }}
122-
123129 steps :
130+ - uses : actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
131+ id : otelbot-token
132+ with :
133+ app-id : ${{ vars.OTELBOT_DOTNET_APP_ID }}
134+ private-key : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
135+
124136 - name : Check out code
125137 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
126138 with :
127139 # Note: By default GitHub only fetches 1 commit which fails the git tag operation below
128140 fetch-depth : 0
129- token : ${{ env.GH_TOKEN }}
141+ token : ${{ steps.otelbot-token.outputs.token }}
130142
131143 - name : Create release tag
132144 id : create-tag
133145 shell : pwsh
134146 env :
147+ GH_TOKEN : ${{ steps.otelbot-token.outputs.token }}
135148 BOT_USER_EMAIL : ${{ needs.automation.outputs.email }}
136149 BOT_USER_NAME : ${{ needs.automation.outputs.username }}
150+ EXPECTED_PR_AUTHOR_USER_NAME : ${{ needs.automation.outputs.application-name }}
137151 ISSUE_NUMBER : ${{ github.event.issue.number }}
138152 run : |
139153 Import-Module .\build\scripts\prepare-release.psm1
140154
141155 CreateReleaseTagAndPostNoticeOnPullRequest `
142156 -gitRepository ${env:GITHUB_REPOSITORY} `
143157 -pullRequestNumber ${env:ISSUE_NUMBER} `
144- -botUserName ${env:BOT_USER_NAME } `
158+ -expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME } `
145159 -gitUserName ${env:BOT_USER_NAME} `
146160 -gitUserEmail ${env:BOT_USER_EMAIL}
147161
@@ -154,28 +168,33 @@ jobs:
154168 github.event_name == 'issue_comment' &&
155169 github.event.issue.pull_request &&
156170 github.event.issue.state == 'open' &&
157- github.event.comment.user.login != needs.automation.outputs.username &&
171+ github.event.comment.user.login != needs.automation.outputs.application- username &&
158172 contains(github.event.comment.body, '/UpdateReleaseDates') &&
159173 startsWith(github.event.issue.title, '[release] Prepare release ') &&
160174 github.event.issue.pull_request.merged_at == null &&
161175 needs.automation.outputs.enabled
162176
163- env :
164- GH_TOKEN : ${{ secrets[needs.automation.outputs.token-secret-name] }}
165-
166177 steps :
178+ - uses : actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
179+ id : otelbot-token
180+ with :
181+ app-id : ${{ vars.OTELBOT_DOTNET_APP_ID }}
182+ private-key : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
183+
167184 - name : Check out code
168185 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
169186 with :
170187 # Note: By default GitHub only fetches 1 commit which fails the git tag operation below
171188 fetch-depth : 0
172- token : ${{ env.GH_TOKEN }}
189+ token : ${{ steps.otelbot-token.outputs.token }}
173190
174191 - name : Update release date
175192 shell : pwsh
176193 env :
194+ GH_TOKEN : ${{ steps.otelbot-token.outputs.token }}
177195 BOT_USER_EMAIL : ${{ needs.automation.outputs.email }}
178196 BOT_USER_NAME : ${{ needs.automation.outputs.username }}
197+ EXPECTED_PR_AUTHOR_USER_NAME : ${{ needs.automation.outputs.application-name }}
179198 COMMENT_USER_NAME : ${{ github.event.comment.user.login }}
180199 ISSUE_NUMBER : ${{ github.event.issue.number }}
181200 run : |
@@ -184,7 +203,7 @@ jobs:
184203 UpdateChangelogReleaseDatesAndPostNoticeOnPullRequest `
185204 -gitRepository ${env:GITHUB_REPOSITORY} `
186205 -pullRequestNumber ${env:ISSUE_NUMBER} `
187- -botUserName ${env:BOT_USER_NAME } `
206+ -expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME } `
188207 -commentUserName ${env:COMMENT_USER_NAME} `
189208 -gitUserName ${env:BOT_USER_NAME} `
190209 -gitUserEmail ${env:BOT_USER_EMAIL}
@@ -198,27 +217,32 @@ jobs:
198217 github.event_name == 'issue_comment' &&
199218 github.event.issue.pull_request &&
200219 github.event.issue.state == 'open' &&
201- github.event.comment.user.login != needs.automation.outputs.username &&
220+ github.event.comment.user.login != needs.automation.outputs.application- username &&
202221 contains(github.event.comment.body, '/UpdateReleaseNotes') &&
203222 startsWith(github.event.issue.title, '[release] Prepare release ') &&
204223 github.event.issue.pull_request.merged_at == null &&
205224 needs.automation.outputs.enabled
206225
207- env :
208- GH_TOKEN : ${{ secrets[needs.automation.outputs.token-secret-name] }}
209-
210226 steps :
227+ - uses : actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
228+ id : otelbot-token
229+ with :
230+ app-id : ${{ vars.OTELBOT_DOTNET_APP_ID }}
231+ private-key : ${{ secrets.OTELBOT_DOTNET_PRIVATE_KEY }}
232+
211233 - name : Check out code
212234 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
213235 with :
214236 # Note: By default GitHub only fetches 1 commit which fails the git tag operation below
215237 fetch-depth : 0
216- token : ${{ env.GH_TOKEN }}
238+ token : ${{ steps.otelbot-token.outputs.token }}
217239
218240 - name : Update release notes
219241 env :
242+ GH_TOKEN : ${{ steps.otelbot-token.outputs.token }}
220243 BOT_USER_EMAIL : ${{ needs.automation.outputs.email }}
221244 BOT_USER_NAME : ${{ needs.automation.outputs.username }}
245+ EXPECTED_PR_AUTHOR_USER_NAME : ${{ needs.automation.outputs.application-name }}
222246 COMMENT_BODY : ${{ github.event.comment.body }}
223247 COMMENT_USER_NAME : ${{ github.event.comment.user.login }}
224248 ISSUE_NUMBER : ${{ github.event.issue.number }}
@@ -229,7 +253,7 @@ jobs:
229253 UpdateReleaseNotesAndPostNoticeOnPullRequest `
230254 -gitRepository ${env:GITHUB_REPOSITORY} `
231255 -pullRequestNumber ${env:ISSUE_NUMBER} `
232- -botUserName ${env:BOT_USER_NAME } `
256+ -expectedPrAuthorUserName ${env:EXPECTED_PR_AUTHOR_USER_NAME } `
233257 -commentUserName ${env:COMMENT_USER_NAME} `
234258 -commentBody $Env:COMMENT_BODY `
235259 -gitUserName ${env:BOT_USER_NAME} `
0 commit comments