MetaMask / MetaMask/metamask-mobile
Fix check for label and template for dependabot PRs
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
Dependabot PRs all fail on the the same label and template check with:
> Could not resolve to a User with the login of 'dependabot'.
```
Run npm run check-template-and-add-labels
> metamask@7.19.0 check-template-and-add-labels
> ts-node ./.github/scripts/check-template-and-add-labels.ts
GraphqlResponseError: Request failed due to following response errors:
- Could not resolve to a User with the login of 'dependabot'.
at /home/runner/work/metamask-mobile/metamask-mobile/node_modules/@octokit/graphql/dist-src/graphql.js:48:19
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async userBelongsToMetaMaskOrg (/home/runner/work/metamask-mobile/metamask-mobile/.github/scripts/check-template-and-add-labels.ts:292:7)
at async main (/home/runner/work/metamask-mobile/metamask-mobile/.github/scripts/check-template-and-add-labels.ts:7[6](https://github.com/MetaMask/metamask-mobile/actions/runs/8553831219/job/23437818209?pr=9139#step:5:7):9) {
request: {
query: '\n' +
' query UserBelongsToMetaMaskOrg($login: String!) {\n' +
' user(login: $login) {\n' +
' organization(login: "MetaMask") {\n' +
' id\n' +
' }\n' +
' }\n' +
' }\n' +
' ',
variables: { login: 'dependabot' }
},
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',
connection: 'close',
'content-encoding': 'gzip',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Thu, 04 Apr 2024 11:26:40 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-accepted-oauth-scopes': 'repo',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-media-type': 'github.bane-preview; format=json',
'x-github-request-id': '[7](https://github.com/MetaMask/metamask-mobile/actions/runs/8553831219/job/23437818209?pr=9139#step:5:8)4C1:2FA44B:31A131A:5023E80:660E8E70',
'x-oauth-scopes': 'public_repo, read:org',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4[9](https://github.com/MetaMask/metamask-mobile/actions/runs/8553831219/job/23437818209?pr=9139#step:5:10)79',
'x-ratelimit-reset': '1712232443',
'x-ratelimit-resource': 'graphql',
'x-ratelimit-used': '21',
'x-xss-protection': '0'
},
response: { data: { user: null }, errors: [ [Object] ] },
errors: [
{
type: 'NOT_FOUND',
path: [Array],
locations: [Array],
message: "Could not resolve to a User with the login of 'dependabot'."
}
],
data: { user: null }
}
Error: Process completed with exit code 1.
```
### Scenario
_No response_
### Design
_No response_
### Technical Details
_No response_
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### Stakeholder review needed before the work gets merged
- [X] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
Check workflow file: `.github/workflows/check-template-and-add-labels.yml`
Example PR: https://github.com/MetaMask/metamask-mobile/actions/runs/8553831219/job/23437818209?pr=9139
Contributor guide
Research direction
Start with .github/workflows/check-template-and-add-labels.yml and .github/scripts/check-template-and-add-labels.ts, especially userBelongsToMetaMaskOrg and the npm run check-template-and-add-labels entry point. Reproduce the failure with a Dependabot PR and verify that the label and template check completes successfully without the unresolved-user error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100