automation: migrate to hardened dependency governance - #11
Merged
Conversation
|
|
||
| class GitHubApi { | ||
| constructor({ token, repository, maxPaginationPages }) { if (!token) throw new Error('GITHUB_TOKEN is required'); if (!repository?.includes('/')) throw new Error('GITHUB_REPOSITORY must be owner/repo'); this.token = token; this.repository = repository; this.maxPaginationPages = maxPaginationPages; [this.owner, this.repo] = repository.split('/'); this.root = `https://api.github.com/repos/${this.owner}/${this.repo}`; } | ||
| async request(method, url, body) { const response = await fetch(url, { method, headers: { Accept: 'application/vnd.github+json', Authorization: `Bearer ${this.token}`, 'X-GitHub-Api-Version': '2022-11-28', 'User-Agent': 'dependency-governance-bot', ...(body ? { 'Content-Type': 'application/json' } : {}) }, body: body ? JSON.stringify(body) : undefined }); const text = await response.text(); let payload = null; if (text) { try { payload = JSON.parse(text); } catch { payload = text; } } if (!response.ok) { const message = typeof payload === 'object' ? payload?.message : payload; throw new Error(`GitHub API ${method} ${url} failed (${response.status}): ${message || 'unknown error'}`); } return payload; } |
|
|
||
| class GitHubApi { | ||
| constructor({ token, repository, maxPaginationPages }) { if (!token) throw new Error('GITHUB_TOKEN is required'); if (!repository?.includes('/')) throw new Error('GITHUB_REPOSITORY must be owner/repo'); this.token = token; this.repository = repository; this.maxPaginationPages = maxPaginationPages; [this.owner, this.repo] = repository.split('/'); this.root = `https://api.github.com/repos/${this.owner}/${this.repo}`; } | ||
| async request(method, url, body) { const response = await fetch(url, { method, headers: { Accept: 'application/vnd.github+json', Authorization: `Bearer ${this.token}`, 'X-GitHub-Api-Version': '2022-11-28', 'User-Agent': 'dependency-governance-bot', ...(body ? { 'Content-Type': 'application/json' } : {}) }, body: body ? JSON.stringify(body) : undefined }); const text = await response.text(); let payload = null; if (text) { try { payload = JSON.parse(text); } catch { payload = text; } } if (!response.ok) { const message = typeof payload === 'object' ? payload?.message : payload; throw new Error(`GitHub API ${method} ${url} failed (${response.status}): ${message || 'unknown error'}`); } return payload; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the first-generation Python Dependabot governor with the hardened Node dependency-governance control plane used by the mature QA repositories.
Key changes:
ci/ci-gate,security/security-gate, anddocs/docs-contractqualification;No Appium capability policy, session lifecycle, device-smoke boundary, test behavior, or security threshold is weakened.