ministryofjustice / operations-engineering

This repository is home to the Operations Engineering's tools and utilities for managing, monitoring, and optimising software development processes at the Ministry of Justice. • This repository is defined and managed in Terraform
https://user-guide.operations-engineering.service.justice.gov.uk/
MIT License
14 stars 5 forks source link

🐛 Generate PAT Token Report Failure #4721

Open abachleda-baca opened 2 months ago

abachleda-baca commented 2 months ago

Generate a token to access Operations Engineering generates an error:

Run actions/create-github-app-token@ad38cffc07bac6e3857755914c4c88bfd2db4da4 with: app-id: private-key: github-api-url: https://api.github.com/ owner and repositories not set, creating token for the current repository ("operations-engineering") Failed to create token for "operations-engineering" (attempt 1): Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app Failed to create token for "operations-engineering" (attempt 2): Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app Failed to create token for "operations-engineering" (attempt 3): Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app Failed to create token for "operations-engineering" (attempt 4): Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app RequestError [HttpError]: Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app at /home/runner/work/_actions/actions/create-github-app-token/ad38cffc07bac6e3857755914c4c88bfd2db4da4/dist/main.cjs:37065:21 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async hook4 (/home/runner/work/_actions/actions/create-github-app-token/ad38cffc07bac6e3857755914c4c88bfd2db4da4/dist/main.cjs:39469:18) at async getTokenFromRepository (/home/runner/work/_actions/actions/create-github-app-token/ad38cffc07bac6e3857755914c4c88bfd2db4da4/dist/main.cjs:39783:20) at async RetryOperation._fn (/home/runner/work/_actions/actions/create-github-app-token/ad38cffc07bac6e3857755914c4c88bfd2db4da4/dist/main.cjs:39660:24) { status: 404, request: { method: 'GET', url: 'https://api.github.com/repos/ministryofjustice/operations-engineering/installation', headers: { accept: 'application/vnd.github.v3+json', 'user-agent': 'actions/create-github-app-token', authorization: 'bearer [REDACTED]' }, request: { hook: [Function: bound hook4] AsyncFunction } }, response: { url: 'https://api.github.com/repos/ministryofjustice/operations-engineering/installation', status: 404, headers: { 'access-control-allow-origin': '*', 'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset', 'content-encoding': 'gzip', 'content-security-policy': "default-src 'none'", 'content-type': 'application/json; charset=utf-8', Error: Not Found - https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app date: 'Fri, 09 Aug 2024 08:08:07 GMT', 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', server: 'github.com', 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 'transfer-encoding': 'chunked', vary: 'Accept-Encoding, Accept, X-Requested-With', 'x-content-type-options': 'nosniff', 'x-frame-options': 'deny', 'x-github-api-version-selected': '2022-11-28', 'x-github-media-type': 'github.v3; format=json', 'x-github-request-id': '8001:1F8F1:DE3342E:1A095759:66B5CE63', 'x-xss-protection': '0' }, data: { message: 'Not Found', documentation_url: 'https://docs.github.com/rest/apps/apps#get-a-repository-installation-for-the-authenticated-app', status: '404' } }, attemptNumber: 4, retriesLeft: 0 }

abachleda-baca commented 2 months ago

This issue is most likely related to the Gihub App authentication according to https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api?apiVersion=2022-11-28#404-not-found-for-an-existing-resource

Perhaps it might be worth to regenerate and update the private key for the app.

abachleda-baca commented 2 months ago

I have generated new private key and updated secrets: OPERATIONS_ENGINEERING_PAT_APP_ID and OE_PAT_APP_PRIVATE_KEY and the issue was fixed. Re-run the failed workflow and was successful.