diff --git a/.github/workflows/ai-flag-cleanup-pr.yml b/.github/workflows/ai-flag-cleanup-pr.yml index 461db2e402..84a407809e 100644 --- a/.github/workflows/ai-flag-cleanup-pr.yml +++ b/.github/workflows/ai-flag-cleanup-pr.yml @@ -40,10 +40,22 @@ jobs: runs-on: ubuntu-latest steps: + - name: Generate GitHub App token + id: app_token + uses: peter-evans/create-github-app-token@v2 + with: + app_id: ${{ secrets.UNLEASH_BOT_APP_ID }} + private_key: ${{ secrets.UNLEASH_BOT_PRIVATE_KEY }} + repository: ${{ github.repository }} + + - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.ref }} + ref: ${{ github.ref }} + token: ${{ steps.app_token.outputs.token }} + fetch-depth: 0 + persist-credentials: true - name: Get issue uses: actions/github-script@v7 @@ -120,14 +132,18 @@ jobs: - name: Check out new branch uses: actions/checkout@v4 with: - ref: ${{ steps.create_branch.outputs.result }} - fetch-depth: 0 + ref: ${{ steps.create_branch.outputs.result }} + token: ${{ steps.app_token.outputs.token }} + fetch-depth: 0 + persist-credentials: true - name: Configure Git + env: + APP_ID: ${{ secrets.UNLEASH_BOT_APP_ID }} run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" + git config --global user.email "${APP_ID}+unleash-ai-flag-cleanup[bot]@users.noreply.github.com" + git config --global user.name "unleash-ai-flag-cleanup[bot]" - name: Install ripgrep run: sudo apt-get update && sudo apt-get install -y ripgrep