carpentries / actions

GitHub Actions for use in Carpentries-style lessons
1 stars 8 forks source link

[check-valid-pr] Catch 5XX errors and explain that it's github's fault #81

Open zkamvar opened 1 year ago

zkamvar commented 1 year ago

There was an error four days ago with a pull request in datacarpentry/R-ecology-lesson (run 5449511449).

The check for files in the pull request failed because it received a read ECONNRESET error (status 500):

Run carpentries/actions/check-valid-pr@main
checking if PR #866 was previously merged
checking for the invalid commit b99f2de74d7d7f2ae62c3471bb8648a648c853ea
checking files in the pull request
RequestError [HttpError]: request to https://api.github.com/repos/datacarpentry/R-ecology-lesson/pulls/866/files failed, reason: read ECONNRESET
    at /home/runner/work/_actions/carpentries/actions/main/check-valid-pr/node_modules/@octokit/request/dist-node/index.js:[10](https://github.com/datacarpentry/R-ecology-lesson/actions/runs/5449511449/jobs/9913805072#step:3:11)7:[11](https://github.com/datacarpentry/R-ecology-lesson/actions/runs/5449511449/jobs/9913805072#step:3:12)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async run (/home/runner/work/_actions/carpentries/actions/main/check-valid-pr/index.js:185:40) {
  status: 500,
  headers: {},
  request: {
    method: 'GET',
    url: 'https://api.github.com/repos/datacarpentry/R-ecology-lesson/pulls/866/files',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-core.js/3.2.4 Node.js/[16](https://github.com/datacarpentry/R-ecology-lesson/actions/runs/5449511449/jobs/9913805072#step:3:17).16.0 (linux; x64)',
      authorization: 'token [REDACTED]'
    },
    request: { agent: [Agent], hook: [Function: bound bound register] }
  }
}

The code that fetches the files in the pull request just prints the error if one occurs, but we should exit (or maybe retry) if the error is 500 or 503, since that indicates a GitHub-side error:

https://github.com/carpentries/actions/blob/e9405d9b8f2f99a2a7fd16a31194fd8563af95c9/check-valid-pr/index.js#L183-L189

Full Log ``` 2023-07-04T00:15:08.1655546Z Requested labels: ubuntu-latest 2023-07-04T00:15:08.1655841Z Job defined at: datacarpentry/R-ecology-lesson/.github/workflows/pr-preflight.yaml@refs/heads/main 2023-07-04T00:15:08.1656027Z Waiting for a runner to pick up this job... 2023-07-04T00:15:08.4634903Z Job is waiting for a hosted runner to come online. 2023-07-04T00:15:11.3913446Z Job is about to start running on the hosted runner: GitHub Actions 2 (hosted) 2023-07-04T00:15:14.1960245Z Current runner version: '2.305.0' 2023-07-04T00:15:14.1987746Z ##[group]Operating System 2023-07-04T00:15:14.1988326Z Ubuntu 2023-07-04T00:15:14.1988580Z 22.04.2 2023-07-04T00:15:14.1988947Z LTS 2023-07-04T00:15:14.1989249Z ##[endgroup] 2023-07-04T00:15:14.1989530Z ##[group]Runner Image 2023-07-04T00:15:14.1989888Z Image: ubuntu-22.04 2023-07-04T00:15:14.1990261Z Version: 20230625.1.0 2023-07-04T00:15:14.1990789Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230625.1.0/images/linux/Ubuntu2204-Readme.md 2023-07-04T00:15:14.1991390Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230625.1.0 2023-07-04T00:15:14.1991855Z ##[endgroup] 2023-07-04T00:15:14.1992209Z ##[group]Runner Image Provisioner 2023-07-04T00:15:14.1992545Z 2.0.238.1 2023-07-04T00:15:14.1992853Z ##[endgroup] 2023-07-04T00:15:14.1993495Z ##[group]GITHUB_TOKEN Permissions 2023-07-04T00:15:14.1994065Z Metadata: read 2023-07-04T00:15:14.1994666Z PullRequests: write 2023-07-04T00:15:14.1995067Z ##[endgroup] 2023-07-04T00:15:14.1999018Z Secret source: Actions 2023-07-04T00:15:14.1999559Z Prepare workflow directory 2023-07-04T00:15:14.2768636Z Prepare all required actions 2023-07-04T00:15:14.2961674Z Getting action download info 2023-07-04T00:15:14.5230513Z Download action repository 'carpentries/actions@main' (SHA:e9405d9b8f2f99a2a7fd16a31194fd8563af95c9) 2023-07-04T00:15:16.1306720Z Complete job name: Test if pull request is valid 2023-07-04T00:15:16.2218212Z ##[group]Run echo "json<> $GITHUB_OUTPUT 2023-07-04T00:15:16.2276967Z shell: /usr/bin/bash -e {0} 2023-07-04T00:15:16.2277257Z ##[endgroup] 2023-07-04T00:15:16.5009873Z ##[group]Run carpentries/actions/check-valid-pr@main 2023-07-04T00:15:16.5010208Z with: 2023-07-04T00:15:16.5010407Z pr: 866 2023-07-04T00:15:16.5010668Z invalid: b99f2de74d7d7f2ae62c3471bb8648a648c853ea 2023-07-04T00:15:16.5010959Z fail_on_error: true 2023-07-04T00:15:16.5011159Z headroom: 1 2023-07-04T00:15:16.5011397Z repo: datacarpentry/R-ecology-lesson 2023-07-04T00:15:16.5011848Z token: *** 2023-07-04T00:15:16.5012043Z ##[endgroup] 2023-07-04T00:15:17.1413875Z checking if PR #866 was previously merged 2023-07-04T00:15:17.1415652Z checking for the invalid commit b99f2de74d7d7f2ae62c3471bb8648a648c853ea 2023-07-04T00:15:17.9325873Z checking files in the pull request 2023-07-04T00:15:18.0486070Z RequestError [HttpError]: request to https://api.github.com/repos/datacarpentry/R-ecology-lesson/pulls/866/files failed, reason: read ECONNRESET 2023-07-04T00:15:18.0486838Z at /home/runner/work/_actions/carpentries/actions/main/check-valid-pr/node_modules/@octokit/request/dist-node/index.js:107:11 2023-07-04T00:15:18.0487298Z at processTicksAndRejections (node:internal/process/task_queues:96:5) 2023-07-04T00:15:18.0487794Z at async run (/home/runner/work/_actions/carpentries/actions/main/check-valid-pr/index.js:185:40) { 2023-07-04T00:15:18.0488496Z status: 500, 2023-07-04T00:15:18.0488695Z headers: {}, 2023-07-04T00:15:18.0488893Z request: { 2023-07-04T00:15:18.0489142Z method: 'GET', 2023-07-04T00:15:18.0489545Z url: 'https://api.github.com/repos/datacarpentry/R-ecology-lesson/pulls/866/files', 2023-07-04T00:15:18.0490233Z headers: { 2023-07-04T00:15:18.0490578Z accept: 'application/vnd.github.v3+json', 2023-07-04T00:15:18.0491018Z 'user-agent': 'octokit-core.js/3.2.4 Node.js/16.16.0 (linux; x64)', 2023-07-04T00:15:18.0491351Z authorization: 'token [REDACTED]' 2023-07-04T00:15:18.0491786Z }, 2023-07-04T00:15:18.0492053Z request: { agent: [Agent], hook: [Function: bound bound register] } 2023-07-04T00:15:18.0492295Z } 2023-07-04T00:15:18.0492462Z } 2023-07-04T00:15:18.0492639Z Is valid?: false 2023-07-04T00:15:18.0562889Z ##[error] ## :warning: No files were found in the pull request :warning: This could mean that this pull request was spoofed, but the details are unclear. 2023-07-04T00:15:18.0638638Z ##[group]Run carpentries/actions/comment-diff@main 2023-07-04T00:15:18.0638956Z with: 2023-07-04T00:15:18.0639133Z pr: 866 2023-07-04T00:15:18.0639509Z body: ## :warning: No files were found in the pull request :warning: This could mean that this pull request was spoofed, but the details are unclear. 2023-07-04T00:15:18.0639906Z repo: datacarpentry/R-ecology-lesson 2023-07-04T00:15:18.0640321Z token: *** 2023-07-04T00:15:18.0640520Z ##[endgroup] 2023-07-04T00:15:19.3971320Z Evaluate and set job outputs 2023-07-04T00:15:19.3985081Z Set output 'is_valid' 2023-07-04T00:15:19.3986304Z Cleaning up orphan processes ```