-
Notifications
You must be signed in to change notification settings - Fork 200
Bug/issue 465 #970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main-enterprise
Are you sure you want to change the base?
Bug/issue 465 #970
Changes from all commits
1107316
0051d0e
bb1b033
6a96579
d57526e
8450339
8a5f2ca
1c081a1
be0a6a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -407,7 +407,7 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) => | |||||
| repo: env.ADMIN_REPO, | ||||||
| path: oldPath, | ||||||
| headers: { | ||||||
| 'X-GitHub-Api-Version': '2022-11-28' | ||||||
| 'X-GitHub-Api-Version': '2026-03-10' | ||||||
| } | ||||||
| }) | ||||||
| let content = Buffer.from(repofile.data.content, 'base64').toString() | ||||||
|
|
@@ -418,10 +418,10 @@ module.exports = (robot, { getRouter }, Settings = require('./lib/settings')) => | |||||
| // Check if a config file already exists for the renamed repo name | ||||||
| await context.octokit.request('GET /repos/{owner}/{repo}/contents/{path}', { | ||||||
| owner: payload.repository.owner.login, | ||||||
| repo: env.ADMIN_REPO, | ||||||
| repo: env.ADMIN_REPO, | ||||||
|
||||||
| repo: env.ADMIN_REPO, | |
| repo: env.ADMIN_REPO, |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,10 +5,18 @@ const Overrides = require('./overrides') | |||||||
| const ignorableFields = [] | ||||||||
| const previewHeaders = { accept: 'application/vnd.github.hellcat-preview+json,application/vnd.github.luke-cage-preview+json,application/vnd.github.zzzax-preview+json' } | ||||||||
| const overrides = { | ||||||||
| 'contexts': { | ||||||||
| 'action': 'reset', | ||||||||
| 'type': 'array' | ||||||||
| }, | ||||||||
| contexts: { | ||||||||
| action: 'reset', | ||||||||
| type: 'array' | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| // GitHub API requires these fields to be present in updateBranchProtection calls | ||||||||
| // See: https://docs.github.com/rest/branches/branch-protection#update-branch-protection | ||||||||
| const requiredBranchProtectionDefaults = { | ||||||||
| required_status_checks: null, | ||||||||
| enforce_admins: null, | ||||||||
|
||||||||
| enforce_admins: null, | |
| enforce_admins: null, | |
| required_pull_request_reviews: null, |
Copilot
AI
Apr 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reformatAndReturnBranchProtection deletes required_status_checks.contexts when it is an empty array. The Branch Protection API schema typically requires contexts to be present whenever required_status_checks is non-null, and removing it can cause 422 errors when the repo uses status checks but has no contexts configured. Consider keeping contexts: [] (or only deleting it when checks is present and the API explicitly allows omitting contexts).
| if (Array.isArray(protection.required_status_checks.contexts) && protection.required_status_checks.contexts.length === 0) { | |
| delete protection.required_status_checks.contexts | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,12 @@ module.exports = class CustomProperties extends Diffable { | |
|
|
||
| // Force all names to lowercase to avoid comparison issues. | ||
| normalizeEntries () { | ||
| this.entries = this.entries.map(({ name, value }) => ({ | ||
| name: name.toLowerCase(), | ||
| value | ||
| })) | ||
| this.entries = this.entries | ||
| .filter(({ name }) => name != null) | ||
| .map(({ name, value }) => ({ | ||
| name: name.toLowerCase(), | ||
| value | ||
| })) | ||
|
Comment on lines
13
to
+20
|
||
| } | ||
|
|
||
| async find () { | ||
|
|
@@ -38,10 +40,12 @@ module.exports = class CustomProperties extends Diffable { | |
|
|
||
| // Force all names to lowercase to avoid comparison issues. | ||
| normalize (properties) { | ||
| return properties.map(({ property_name: propertyName, value }) => ({ | ||
| name: propertyName.toLowerCase(), | ||
| value | ||
| })) | ||
| return properties | ||
| .filter(({ property_name: propertyName }) => propertyName != null) | ||
| .map(({ property_name: propertyName, value }) => ({ | ||
| name: propertyName.toLowerCase(), | ||
| value | ||
| })) | ||
|
Comment on lines
41
to
+48
|
||
| } | ||
|
|
||
| comparator (existing, attrs) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Branch Protection docs TIP links to the Actions Variables endpoint ("Update a repository variable") instead of the Branch Protection endpoint. Update the link text + URL to point at the branch protection REST API docs for updating branch protection.