Remove cyborg wording from weighted approval
This commit is contained in:
1 parent
cad50c2504
commit
1eaba2809b
4 files changed
+7
-11
No files matched your search
@@ -8,7 +8,6 @@ const API_VERSION = '2026-03-10'
|
||||
const MAX_PULL_REQUEST_REVIEWS = 3_000
|
||||
const PAGE_SIZE = 100
|
||||
const STATUS_CONTEXT = 'weighted approval'
|
||||
const STATUS_PREFIX = 'This is by automated Angry Turtle Cyborg, not a human'
|
||||
const WRITABLE_PERMISSIONS = new Set(['admin', 'write'])
|
||||
const REVIEW_STATES = new Set(['APPROVED', 'CHANGES_REQUESTED', 'COMMENTED', 'DISMISSED', 'PENDING'])
|
||||
const LOGIN = /^[A-Za-z0-9-]+(?:\[bot\])?$/u
|
||||
@@ -192,12 +191,11 @@ export async function evaluateApproval({ event, policySource, api }) {
|
||||
*/
|
||||
export async function runApprovalCheck({ event, policySource, api, runUrl, write = line => process.stdout.write(`${line}\n`) }) {
|
||||
const pull = pullRequestFromEvent(event)
|
||||
write(STATUS_PREFIX)
|
||||
let result
|
||||
try {
|
||||
result = await evaluateApproval({ event, policySource, api })
|
||||
} catch (error) {
|
||||
await publishStatus(api, pull, 'error', `${STATUS_PREFIX}: approval evaluation failed.`, runUrl)
|
||||
await publishStatus(api, pull, 'error', 'Approval evaluation failed.', runUrl)
|
||||
throw error
|
||||
}
|
||||
write(`Approval score: ${result.points}/${result.requiredPoints}.`)
|
||||
@@ -239,7 +237,7 @@ function approvalResult(pull, requiredPoints, approvals, blockers, ignoredReview
|
||||
return {
|
||||
pull: { repository: pull.repository, number: pull.number, headSha: pull.headSha },
|
||||
state,
|
||||
description: `${STATUS_PREFIX}: ${detail}.`,
|
||||
description: `${detail}.`,
|
||||
points: approvals.reduce((total, approval) => total + approval.points, 0),
|
||||
requiredPoints,
|
||||
approvals,
|
||||
@@ -355,7 +353,6 @@ async function main() {
|
||||
api,
|
||||
})
|
||||
if (resolved === null) {
|
||||
process.stdout.write(`${STATUS_PREFIX}\n`)
|
||||
process.stdout.write('Skipped a review event for a superseded pull-request head.\n')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -266,12 +266,12 @@ test('publishes the required status and replaces stale success with error on eva
|
||||
body: {
|
||||
state: 'success',
|
||||
context: 'weighted approval',
|
||||
description: 'This is by automated Angry Turtle Cyborg, not a human: 2/2 approval points.',
|
||||
description: '2/2 approval points.',
|
||||
target_url: 'https://github.example/actions/runs/1',
|
||||
},
|
||||
},
|
||||
})
|
||||
assert.equal(output[0], 'This is by automated Angry Turtle Cyborg, not a human')
|
||||
assert.equal(output[0], 'Approval score: 2/2.')
|
||||
|
||||
const failures = []
|
||||
await assert.rejects(runApprovalCheck({
|
||||
@@ -289,6 +289,7 @@ test('publishes the required status and replaces stale success with error on eva
|
||||
write: () => {},
|
||||
}), /reviews unavailable/u)
|
||||
assert.equal(failures[0].options.body.state, 'error')
|
||||
assert.equal(failures[0].options.body.description, 'Approval evaluation failed.')
|
||||
})
|
||||
|
||||
test('sends authenticated JSON and escapes an API error body', async () => {
|
||||
|
||||
@@ -14,6 +14,4 @@ jobs:
|
||||
timeout-minutes: 2
|
||||
steps:
|
||||
- name: Record review event
|
||||
run: |
|
||||
echo 'This is by automated Angry Turtle Cyborg, not a human'
|
||||
echo 'Recorded a weighted approval review event.'
|
||||
run: echo 'Recorded a weighted approval review event.'
|
||||
@@ -837,7 +837,7 @@ describe('Weighted approval workflow', () => {
|
||||
'timeout-minutes': 2,
|
||||
})
|
||||
expect(record).toBeDefined()
|
||||
expect(record?.run).toContain('This is by automated Angry Turtle Cyborg, not a human')
|
||||
expect(record?.run).toBe("echo 'Recorded a weighted approval review event.'")
|
||||
expect(recordSteps).toHaveLength(1)
|
||||
expect(JSON.stringify(publisher)).not.toContain('github.event.pull_request.head')
|
||||
expect(JSON.stringify(publisher)).not.toContain('secrets.')
|
||||
|
||||
Reference in new issue
Block a user