A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ad-m/github-push-action/issues/173 below:

Using a Github App Token instead of PAT · Issue #173 · ad-m/github-push-action · GitHub

I'm working with the new Ruleset feature in Github and I'm running into an issue with the push action + custom token.

I have a Github App that I have granted access to the repo. In my Rule, I also allow this application to bypass rule prohibiting pushing to a particular branch. I'm using the github-app-token action to generate a token. Rules currently do not have a way to allow github-actions[bot] to bypass them (see this discussion for more info).

I am able to push a commit fine using the push action, but when I check the rule insights, it shows the commit as coming from github-actions[bot] instead of my custom app. Is it possible to use a Github App token in this action?

Example action:

jobs:
  cherry-pick-commit:
    runs-on: self-hosted
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Generate Githup App Token
        id: generate_token
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.APP_ID }}
          installation_id: ${{ secrets.INSTALLATION_ID }}
          private_key:  ${{ secrets.APP_PRIVATE_KEY }}

      - name: Define Branch Name
        id: branch_name
        run: echo "BRANCH=$(./bin/branch-name ${{ github.event.inputs.action }})" >> "$GITHUB_ENV"

      - name: Setup Git User
        run: |
          # Extract commit information
          AUTHOR_NAME=$(git show -s --format='%an' ${{ github.event.inputs.commit }})
          AUTHOR_EMAIL=$(git show -s --format='%ae' ${{ github.event.inputs.commit }})
          git config --local user.email "${AUTHOR_EMAIL}"
          git config --local user.name "${AUTHOR_NAME}"
      - name: Checkout Branch
        run: git checkout ${{ env.BRANCH }}

      - name: Cherry Pick
        run: |
          git cherry-pick -X theirs ${{ github.event.inputs.commit }}
    
      - name: Push changes
        uses: ad-m/github-push-action@v0.6.0
        env:
          TOKEN: ${{ steps.generate_token.outputs.token }}
        with:
          github_token: ${{ env.TOKEN }}
          branch: ${{ env.BRANCH }}

Here's the insight showing that it came from github-actions[bot]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4