@@ -10,25 +10,35 @@ jobs:
1010 promote-apis :
1111 runs-on : ubuntu-latest
1212 permissions :
13- contents : write
14- pull-requests : write
13+ contents : read
1514
1615 steps :
1716 - name : Checkout code
1817 uses : actions/checkout@v6
1918 with :
2019 fetch-depth : 0
2120
21+ - name : Generate GitHub App token
22+ id : app-token
23+ uses : actions/create-github-app-token@v2
24+ with :
25+ app-id : ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }}
26+ private-key : ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }}
27+
2228 - name : Configure git
29+ shell : pwsh
30+ env :
31+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
2332 run : |
2433 git config --global user.name "github-actions[bot]"
2534 git config --global user.email "github-actions[bot]@users.noreply.github.com"
35+ git config --global url."https://x-access-token:$env:GH_TOKEN@github.com/".insteadOf "https://github.com/"
2636
2737 - name : Check for existing PR
2838 id : check_pr
2939 shell : pwsh
3040 env :
31- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
41+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
3242 run : |
3343 $branch = "${{ github.ref_name }}"
3444 $prs = gh pr list --state open --head "promote-shipped-apis-$branch" --json number --jq '.[0].number' 2>$null
91101 if : steps.check_pr.outputs.pr_exists == 'false' && steps.check_changes.outputs.has_changes == 'true'
92102 shell : pwsh
93103 env :
94- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104+ GH_TOKEN : ${{ steps.app-token.outputs.token }}
95105 run : |
96106 $branch = "${{ github.ref_name }}"
97107 $prBranch = "promote-shipped-apis-$branch"
@@ -102,21 +112,3 @@ jobs:
102112
103113 gh pr create --title "$title" --base "$branch" --head "$prBranch" --body "Automatically promotes unshipped APIs to shipped after running the promotion script."
104114
105- - name : Dispatch other workflows
106- shell : pwsh
107- env :
108- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109- run : |
110- $owner = "${{ github.repository_owner }}"
111- $repo = "${{ github.event.repository.name }}"
112- $branch = "${{ github.ref_name }}"
113-
114- # Get all workflows
115- $workflows = gh workflow list --repo "$owner/$repo" --json name --jq '.[].name'
116-
117- foreach ($workflow in $workflows) {
118- if ($workflow -ne "Promote Shipped APIs") {
119- Write-Host "Dispatching workflow: $workflow"
120- gh workflow run "$workflow" --repo "$owner/$repo" --ref "$branch" 2>$null || Write-Host "Could not dispatch $workflow"
121- }
122- }
0 commit comments