From 199200f307219e3c6cd31e5beace77384cf2e39f Mon Sep 17 00:00:00 2001 From: Enoch R Lindeman Date: Thu, 12 Sep 2024 19:30:32 -0700 Subject: [PATCH] Update rust-ci.yml (#35) Key Changes: Generate GitHub App Token: Uses tibdex/github-app-token@v1 to generate an installation token. Inputs: app_id: The App ID stored in your repository variables. private_key: The private key stored in your repository secrets. Outputs: The action outputs a token that you can use for authentication. Checkout Code with Token: In actions/checkout@v3, set the token input to ${{ steps.generate_token.outputs.token }}. Use Token in Other Actions: For any actions that require authentication (e.g., peter-evans/create-pull-request@v4), use the generated token: token: ${{ steps.generate_token.outputs.token }} --- .github/workflows/rust-ci.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 6317a989b..75ab5d6a1 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -15,13 +15,22 @@ jobs: permissions: contents: write pull-requests: write - checks: write # Needed for waiting on status checks - statuses: write + issues: write + actions: write steps: - - uses: actions/checkout@v3 + - name: Generate GitHub App Token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ vars.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_PRIVATE_KEY }} + + - name: Checkout code + uses: actions/checkout@v3 with: fetch-depth: 0 + token: ${{ steps.generate_token.outputs.token }} - name: Install Rust stable uses: actions-rs/toolchain@v1 @@ -60,7 +69,7 @@ jobs: if: steps.changes.outputs.changes == 'true' uses: peter-evans/create-pull-request@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ steps.generate_token.outputs.token }} commit-message: "Apply rustfmt formatting" branch: formatting-fixes title: "Automated Formatting Fixes"