Update ScriptErrorEvaluationFailed with DebugPlutusFailure #4171
This file contains 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
name: Check if PR changelog was filled correctly | |
on: | |
merge_group: | |
pull_request: | |
types: [opened, edited, synchronize, ready_for_review] | |
jobs: | |
check-changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
if: ${{ github.event_name != 'merge_group' }} | |
with: | |
node-version: 16 | |
- run: npm install [email protected] | |
if: ${{ github.event_name != 'merge_group' }} | |
- name: Fail if PR changelog is not correct | |
if: ${{ github.event_name != 'merge_group' }} | |
uses: actions/github-script@v6 | |
id: check-changelog | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const yaml = require('js-yaml'); | |
const fs = require('fs'); | |
const prDescription = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.issue.number | |
}); | |
const changelogRegex = /# Changelog[\s\S]*?```yaml([\s\S]*?)```/; | |
const changelogMatch = prDescription.data.body.match(changelogRegex); | |
const yamlContent = changelogMatch ? changelogMatch[1].trim() : ''; | |
yamlContent || console.error('Failed to find changelog YAML section in the "Changelog" paragraph'); | |
try { | |
changelog = yaml.load(yamlContent)[0]; | |
} catch (e) { | |
console.error('Failed to parse YAML changelog as array:', yamlContent); | |
process.exit(1); | |
} | |
try { | |
config = yaml.load(fs.readFileSync('.cardano-dev.yaml', 'utf8')); | |
} catch (e) { | |
console.error('Failed to load .cardano-dev.yaml config:', e); | |
process.exit(1); | |
} | |
let isCompatibilityValid = false; | |
if (!changelog.compatibility) { | |
isCompatibilityValid = true; | |
} | |
if (!isCompatibilityValid) { | |
console.error('Changelog field "compatibility" is deprecated and no longer used. Please remove it.'); | |
} | |
let isTypeValid = false; | |
const validTypeValues = Object.keys(config.changelog.options.type); | |
if (Array.isArray(changelog.type) && !!changelog.type) { | |
isTypeValid = changelog.type.every(value => validTypeValues.includes(value)); | |
} else { | |
isTypeValid = validTypeValues.includes(changelog.type); | |
} | |
if (!isTypeValid) { | |
console.error(`PR changelog has invalid type: ${changelog.type}\nExpected one, or more of: ${validTypeValues}`) | |
} | |
let isDescriptionValid = true; | |
if (changelog.description.trim() === '<insert-changelog-description-here>') { | |
console.error('PR changelog description has not been updated!') | |
isDescriptionValid = false; | |
} else if (!changelog.description.trim()) { | |
console.error('PR changelog description field is missing!') | |
isDescriptionValid = false; | |
} | |
if (!isCompatibilityValid || !isTypeValid || !isDescriptionValid) { | |
console.error('Failed PR changelog checks!'); | |
process.exit(1); | |
} | |