FirebaseExtended / action-hosting-deploy

Automatically deploy shareable previews for your Firebase Hosting sites
https://firebase.google.com/docs/hosting/github-integration
Apache License 2.0
704 stars 202 forks source link

[BUG] [HttpError]: Resource not accessible by integration #321

Closed MrHamidKhan closed 11 months ago

MrHamidKhan commented 11 months ago

Action config

Error message

2023-11-25T14:27:09.7059486Z ##[group]Run FirebaseExtended/action-hosting-deploy@v0 2023-11-25T14:27:09.7060519Z with: 2023-11-25T14:27:09.7061212Z repoToken: 2023-11-25T14:27:09.7077473Z firebaseServiceAccount:

2023-11-25T14:27:09.7078124Z expires: 30d 2023-11-25T14:27:09.7078758Z projectId: sell-the-scrap-frontend 2023-11-25T14:27:09.7079432Z entryPoint: . 2023-11-25T14:27:09.7080070Z firebaseToolsVersion: latest 2023-11-25T14:27:09.7080676Z ##[endgroup] 2023-11-25T14:27:10.1225572Z /home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:84764 2023-11-25T14:27:10.1226988Z const error = new RequestError(toErrorMessage(data), status, 2023-11-25T14:27:10.1227698Z ^ 2023-11-25T14:27:10.1228034Z 2023-11-25T14:27:10.1228375Z RequestError [HttpError]: Resource not accessible by integration 2023-11-25T14:27:10.1229565Z at /home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:84764:27 2023-11-25T14:27:10.1230686Z at processTicksAndRejections (node:internal/process/task_queues:96:5) 2023-11-25T14:27:10.1232078Z at async createCheck (/home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:87337:17) 2023-11-25T14:27:10.1233653Z at async run (/home/runner/work/_actions/FirebaseExtended/action-hosting-deploy/v0/bin/action.min.js:93186:14) 2023-11-25T14:27:10.1234609Z status: 403, 2023-11-25T14:27:10.1234985Z response: 2023-11-25T14:27:10.1235685Z url: 'https://api.github.com/repos/sell-the-scrap/frontend/check-runs', 2023-11-25T14:27:10.1236406Z status: 403, 2023-11-25T14:27:10.1236784Z headers: 2023-11-25T14:27:10.1237261Z 'access-control-allow-origin': '*', 2023-11-25T14:27:10.1240083Z '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', 2023-11-25T14:27:10.1242347Z connection: 'close', 2023-11-25T14:27:10.1242846Z 'content-encoding': 'gzip', 2023-11-25T14:27:10.1243478Z 'content-security-policy': "default-src 'none'", 2023-11-25T14:27:10.1244238Z 'content-type': 'application/json; charset=utf-8', 2023-11-25T14:27:10.1244931Z date: 'Sat, 25 Nov 2023 14:27:10 GMT', 2023-11-25T14:27:10.1245830Z 'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin', 2023-11-25T14:27:10.1246662Z server: 'GitHub.com', 2023-11-25T14:27:10.1247433Z 'strict-transport-security': 'max-age=31536000; includeSubdomains; preload', 2023-11-25T14:27:10.1248247Z 'transfer-encoding': 'chunked', 2023-11-25T14:27:10.1248917Z vary: 'Accept-Encoding, Accept, X-Requested-With', 2023-11-25T14:27:10.1249669Z 'x-accepted-github-permissions': 'checks=write', 2023-11-25T14:27:10.1250358Z 'x-content-type-options': 'nosniff', 2023-11-25T14:27:10.1250942Z 'x-frame-options': 'deny', 2023-11-25T14:27:10.1251556Z 'x-github-api-version-selected': '2022-11-28', 2023-11-25T14:27:10.1252275Z 'x-github-media-type': 'github.v3; format=json', 2023-11-25T14:27:10.1253086Z 'x-github-request-id': '48C0:4FD2:CCB179:1AF5D8A:6562043D', 2023-11-25T14:27:10.1253784Z 'x-ratelimit-limit': '1000', 2023-11-25T14:27:10.1254343Z 'x-ratelimit-remaining': '998', 2023-11-25T14:27:10.1254916Z 'x-ratelimit-reset': '1700925823', 2023-11-25T14:27:10.1255489Z 'x-ratelimit-resource': 'core', 2023-11-25T14:27:10.1256040Z 'x-ratelimit-used': '2', 2023-11-25T14:27:10.1256547Z 'x-xss-protection': '0' 2023-11-25T14:27:10.1256995Z , 2023-11-25T14:27:10.1257334Z data: 2023-11-25T14:27:10.1257871Z message: 'Resource not accessible by integration', 2023-11-25T14:27:10.1258822Z documentation_url: 'https://docs.github.com/rest/checks/runs#create-a-check-run' 2023-11-25T14:27:10.1259578Z 2023-11-25T14:27:10.1260302Z , 2023-11-25T14:27:10.1260637Z request: 2023-11-25T14:27:10.1261063Z method: 'POST', 2023-11-25T14:27:10.1261761Z url: 'https://api.github.com/repos/sell-the-scrap/frontend/check-runs', 2023-11-25T14:27:10.1262493Z headers: 2023-11-25T14:27:10.1263004Z accept: 'application/vnd.github.v3+json', 2023-11-25T14:27:10.1263828Z 'user-agent': 'octokit-core.js/3.6.0 Node.js/16.20.2 (linux; x64)', 2023-11-25T14:27:10.1264591Z authorization: 'token [REDACTED]', 2023-11-25T14:27:10.1265271Z 'content-type': 'application/json; charset=utf-8' 2023-11-25T14:27:10.1265843Z , 2023-11-25T14:27:10.1266752Z body: '"name":"Deploy Preview","head_sha":"952cd4c6cfb52ca113c486f77d7816e33f19b00b","status":"in_progress"', 2023-11-25T14:27:10.1267702Z request: 2023-11-25T14:27:10.1268096Z agent: Agent 2023-11-25T14:27:10.1268575Z _events: [Object: null prototype] 2023-11-25T14:27:10.1269169Z free: [Function (anonymous)], 2023-11-25T14:27:10.1269783Z newListener: [Function: maybeEnableKeylog] 2023-11-25T14:27:10.1270384Z , 2023-11-25T14:27:10.1270747Z _eventsCount: 2, 2023-11-25T14:27:10.1271186Z _maxListeners: undefined, 2023-11-25T14:27:10.1272285Z defaultPort: 443, 2023-11-25T14:27:10.1272779Z protocol: 'https:', 2023-11-25T14:27:10.1273343Z options: [Object: null prototype] path: null , 2023-11-25T14:27:10.1274032Z requests: [Object: null prototype] , 2023-11-25T14:27:10.1274653Z sockets: [Object: null prototype] , 2023-11-25T14:27:10.1275270Z freeSockets: [Object: null prototype] , 2023-11-25T14:27:10.1275860Z keepAliveMsecs: 1000, 2023-11-25T14:27:10.1276497Z keepAlive: false, 2023-11-25T14:27:10.1276934Z maxSockets: Infinity, 2023-11-25T14:27:10.1277397Z maxFreeSockets: 256, 2023-11-25T14:27:10.1277897Z scheduling: 'lifo', 2023-11-25T14:27:10.1278356Z maxTotalSockets: Infinity, 2023-11-25T14:27:10.1278859Z totalSocketCount: 0, 2023-11-25T14:27:10.1279327Z maxCachedSessions: 100, 2023-11-25T14:27:10.1279812Z _sessionCache: 2023-11-25T14:27:10.1280239Z map: 2023-11-25T14:27:10.1294237Z 'api.github.com:443:::::::::::::::::::::': [Buffer [Uint8Array]] 2023-11-25T14:27:10.1295008Z , 2023-11-25T14:27:10.1295638Z list: [ 'api.github.com:443:::::::::::::::::::::' ] 2023-11-25T14:27:10.1296221Z , 2023-11-25T14:27:10.1296606Z [Symbol(kCapture)]: false 2023-11-25T14:27:10.1297069Z , 2023-11-25T14:27:10.1297478Z hook: [Function: bound bound register] 2023-11-25T14:27:10.1297997Z 2023-11-25T14:27:10.1298343Z 2023-11-25T14:27:10.1298663Z

andyflesner commented 11 months ago

This is not a bug. I had the same issue and noticed the 403 response code. You have to grant workflows write access in your repo under Settings->Actions->General->Workflow Permissions. Choosing "Read and Write Permissions" resolved this same issue for me.

LaiArturs commented 11 months ago

I had the same issue, and applied the fix mentioned above - it worked! However, I think not being able to comment in a PR should not result in a failure of the action, but with a warning in logs. Therefore, I believe there should be catch statement for this function call.

vveliev commented 11 months ago

Another option is to set permissions on the github action job

jobs:  
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write
      checks: write
    steps:
      - uses: actions/checkout@v4      
      - name: Deploy to live
        uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
          channelId: live
          projectId: my-awesome-project
MrHamidKhan commented 11 months ago

I already have the settings like that, still doesn't work. But I am closing it down because I have tried it on other repo, it worked.

This is not a bug. I had the same issue and noticed the 403 response code. You have to grant workflows write access in your repo under Settings->Actions->General->Workflow Permissions. Choosing "Read and Write Permissions" resolved this same issue for me.