Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
- name: Upload YAML config
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ env.TF_WORKSPACE }}.yml
name: fixed-config-${{ env.TF_WORKSPACE }}
path: github/${{ env.TF_WORKSPACE }}.yml
if-no-files-found: error
retention-days: 1
Expand Down Expand Up @@ -177,10 +177,10 @@ jobs:
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
pattern: fixed-config-*
merge-multiple: true
- name: Copy YAML configs
run: |
shopt -s globstar
cp artifacts/**/*.yml head/github
run: cp artifacts/*.yml head/github
- name: Check if github was modified
id: github-modified
run: |
Expand Down
27 changes: 27 additions & 0 deletions scripts/__tests__/workflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type WorkflowStep = {
name?: string
run?: string
env?: Record<string, string>
with?: Record<string, unknown>
}

type Workflow = {
Expand Down Expand Up @@ -58,4 +59,30 @@ describe('workflows', () => {
assert.ok(steps.includes('Publish access report summary'))
assert.ok(steps.includes('Upload access report'))
})

it('downloads only fixed YAML config artifacts before pushing fix changes', () => {
const fix = workflow('fix.yml')
const fixSteps = fix.jobs.fix.steps
const pushSteps = fix.jobs.push.steps
const uploadYamlStep = fixSteps.find(
step => step.name === 'Upload YAML config'
)
const downloadYamlStep = pushSteps.find(
step => step.name === 'Download YAML configs'
)
const copyYamlStep = pushSteps.find(
step => step.name === 'Copy YAML configs'
)

assert.ok(uploadYamlStep)
assert.ok(downloadYamlStep)
assert.ok(copyYamlStep)
assert.equal(
uploadYamlStep.with?.name,
'fixed-config-${{ env.TF_WORKSPACE }}'
)
assert.equal(downloadYamlStep.with?.pattern, 'fixed-config-*')
assert.equal(downloadYamlStep.with?.['merge-multiple'], true)
assert.equal(copyYamlStep.run, 'cp artifacts/*.yml head/github')
})
})
Loading