diff --git a/scripts/__tests__/actions/access-summary.test.ts b/scripts/__tests__/actions/access-summary.test.ts index 6abe256..eeace16 100644 --- a/scripts/__tests__/actions/access-summary.test.ts +++ b/scripts/__tests__/actions/access-summary.test.ts @@ -206,7 +206,9 @@ members: const comment = describeAccessChangesComment(state, config) - assert.match(comment, /Access Changes<\/summary>/) + assert.match(comment, /The following access changes/) + assert.match(comment, /For the full access breakdown/) + assert.match(comment, /
Access Changes<\/summary>/) assert.doesNotMatch(comment, /Potential no members/) assert.doesNotMatch(comment, /Any other members/) }) diff --git a/scripts/__tests__/workflows.test.ts b/scripts/__tests__/workflows.test.ts index 8ee388f..fb19575 100644 --- a/scripts/__tests__/workflows.test.ts +++ b/scripts/__tests__/workflows.test.ts @@ -1,5 +1,5 @@ import assert from 'node:assert' -import {readFileSync} from 'node:fs' +import {existsSync, readFileSync} from 'node:fs' import {describe, it} from 'node:test' import * as YAML from 'yaml' @@ -47,13 +47,14 @@ describe('workflows', () => { assert.match(applyStep.run ?? '', /allow_destroy_override\.tf\.disabled/) }) - it('provides a manual access report workflow with summary and artifact output', () => { - const report = workflow('access-report.yml') - const steps = report.jobs.report.steps.map(step => step.name) + it('does not provide a manual access report workflow', () => { + assert.equal(existsSync('../.github/workflows/access-report.yml'), false) + }) + + it('publishes the full access report from the fix workflow', () => { + const fix = workflow('fix.yml') + const steps = fix.jobs.fix.steps.map(step => step.name) - assert.ok(report.on.workflow_dispatch) - assert.equal(report.jobs.report.environment, 'read') - assert.ok(steps.includes('Generate access report')) assert.ok(steps.includes('Publish access report summary')) assert.ok(steps.includes('Upload access report')) }) diff --git a/scripts/src/actions/shared/describe-access-changes.ts b/scripts/src/actions/shared/describe-access-changes.ts index 3e328d8..b4120a4 100644 --- a/scripts/src/actions/shared/describe-access-changes.ts +++ b/scripts/src/actions/shared/describe-access-changes.ts @@ -40,6 +40,10 @@ export function describeAccessChangesComment( runUrl = workflowRunUrl() ): string { const accessChangesDescription = describeAccessChanges(state, config) + const reportDestination = + runUrl === undefined + ? 'the Fix workflow summary or access report artifact' + : `[the Fix workflow summary or access report artifact](${runUrl})` const comment = [ 'The following access changes will be introduced as a result of applying the plan:', '', @@ -49,19 +53,16 @@ export function describeAccessChangesComment( accessChangesDescription, '```', '', - '
' + '', + '', + `For the full access breakdown, inspect ${reportDestination}.` ].join('\n') if (Buffer.byteLength(comment, 'utf8') < maxLength) { return comment } - const destination = - runUrl === undefined - ? 'the Fix workflow summary or the access report artifact' - : `[the Fix workflow summary or access report artifact](${runUrl})` - - return `Access changes are too long to post as a comment. Please inspect ${destination} instead.` + return `Access changes are too long to post as a comment. Please inspect ${reportDestination} instead.` } export function describeAccessReport(state: State, config: Config): string {