Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/promote-shipped-apis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ on:
workflow_dispatch:

permissions:
contents: write
pull-requests: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,23 +18,42 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
Comment thread
baywet marked this conversation as resolved.
with:
client-id: ${{ secrets.GHA_TOKEN_PROVIDER_APP_ID }}
private-key: ${{ secrets.GHA_TOKEN_PROVIDER_PEM }}
Comment thread
Copilot marked this conversation as resolved.
permission-contents: write
permission-pull-requests: write

- name: Get GitHub App user ID
id: get-user-id
shell: bash
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"

- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ steps.app-token.outputs.token }}

- name: Configure git
shell: pwsh
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "${{ steps.app-token.outputs.app-slug }}[bot]"
git config user.email "${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
git config --global url."https://$($env:GH_TOKEN)@github.com/".insteadOf "https://github.com/"

- name: Check for existing PR
id: check_pr
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
$branch = "${{ github.ref_name }}"
$prBranch = "promote-shipped-apis-$branch"
Expand Down Expand Up @@ -95,7 +113,7 @@ jobs:
if: steps.check_pr.outputs.pr_exists == 'false' && steps.check_changes.outputs.has_changes == 'true'
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
$branch = "${{ github.ref_name }}"
$prBranch = "promote-shipped-apis-$branch"
Expand Down
Loading