3232 dotnet_result : ${{ steps.dotnet_instrumentation_watcher.outcome }}
3333 configuration_result : ${{ steps.configuration_watcher.outcome }}
3434 steps :
35- - name : Checkout code
36- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37- with :
38- token : ${{ secrets.GITHUB_TOKEN }}
39- # Persisted credentials are required so the later `git push -f origin
40- # HEAD:${BRANCH}` step can authenticate.
41- persist-credentials : true
42-
4335 - name : Detect repository type (if on a fork we use different git config)
4436 id : repo_check
4537 env :
@@ -51,19 +43,37 @@ jobs:
5143 echo "is_primary=false" >> $GITHUB_OUTPUT
5244 fi
5345
54- - name : Configure git (primary repository)
55- if : steps.repo_check.outputs.is_primary == 'true'
56- run : |
57- .github/scripts/use-cla-approved-bot.sh
58-
46+ # Mint the otelbot App token BEFORE checkout so it can be persisted as the
47+ # git credential. Pushes authenticated with the App token trigger
48+ # downstream workflows (e.g. CodeQL on the PR); pushes authenticated with
49+ # the default GITHUB_TOKEN do not, which previously left automated-update
50+ # PRs blocked waiting for code-scanning results after a branch update.
5951 - uses : actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
6052 if : steps.repo_check.outputs.is_primary == 'true'
6153 id : otelbot-token
6254 with :
6355 app-id : ${{ vars.OTELBOT_APP_ID }}
6456 private-key : ${{ secrets.OTELBOT_PRIVATE_KEY }}
6557 repositories : ${{ github.event.repository.name }}
66- permission-pull-requests : write
58+ permission-contents : write # Push registry updates to the update branch
59+ permission-pull-requests : write # Create or update the automated PR
60+
61+ - name : Checkout code
62+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
63+ with :
64+ # On the primary repo, persist the otelbot App token so the later
65+ # `git push -f origin HEAD:${BRANCH}` authenticates as the App and
66+ # triggers downstream workflows. Forks have no App secret and fall
67+ # back to GITHUB_TOKEN.
68+ token :
69+ ${{ steps.repo_check.outputs.is_primary == 'true' && steps.otelbot-token.outputs.token
70+ || secrets.GITHUB_TOKEN }}
71+ persist-credentials : true
72+
73+ - name : Configure git (primary repository)
74+ if : steps.repo_check.outputs.is_primary == 'true'
75+ run : |
76+ .github/scripts/use-cla-approved-bot.sh
6777
6878 - name : Configure git (forked repository)
6979 if : steps.repo_check.outputs.is_primary == 'false'
0 commit comments