actions / create-github-app-token

GitHub Action for creating a GitHub App Installation Access Token
https://github.com/marketplace/actions/create-github-app-token
MIT License
370 stars 54 forks source link

Retrieving the app's bot user no longer works #172

Closed gastaldi closed 4 weeks ago

gastaldi commented 4 weeks ago

The following instructions do not work anymore:

The following step fails:

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

Even https://api.github.com/users/dependabot[bot] returns 404, I wonder if something changed in GitHub that broke this behavior

hypery2k commented 4 weeks ago

did you installed your app in the org? image There should be an install button in the middle of the screen.

Had the same error and installing resolved it for me

infinisil commented 4 weeks ago

I'm having the same problem and can confirm that the App is installed on the org.

Note that it doesn't actually fail the workflow, but rather just messes up the commits: https://github.com/NixOS/SC-election-2024/commit/f0ef6dfead7172602ff814e979f09574f4096ab1

In the patch it shows as:

From: "nix-elections[bot]"
 <{
  "message":"Resource not accessible by integration",
  "documentation_url":"https://docs.github.com/rest",
  "status":"403"
 }+nix-elections[bot]@users.noreply.github.com>

Notably with the status code 403, rather than the 404 reported when running the corresponding command locally.

gastaldi commented 4 weeks ago

@hypery2k yes, it is installed in my org. I am seeing the same behavior as @infinisil described above

StepanKuksenko commented 4 weeks ago

I experience the same issue:

      - name: Get token
        id: generate-token
        uses: actions/create-github-app-token@v1
        with:
          app-id: ${{ vars.APP_ID }}
          private-key: ${{ secrets.PRIVATE_KEY }}
          owner: "org-name"
          repositories: "repo-name"

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

error:

gh: Resource not accessible by integration (HTTP 403)

The latest successful run was yesterday (Sep 16)

gastaldi commented 4 weeks ago

Looks like it's working again now, can you confirm? I am not sure what changed

StepanKuksenko commented 4 weeks ago

Now it works for me as well 🤷‍♂️

gastaldi commented 4 weeks ago

Ok, I'll close this issue since it seems to work now, but seems to be a GitHub glitch, which should probably be reported somewhere else