fix: fix YAML parsing issues in PR gate workflows

- Wrap if condition in ${{ }} to avoid YAML tag interpretation
- Use array.join for multiline message to avoid block scalar issues
This commit is contained in:
Mario Zechner 2026-01-18 12:31:25 +01:00
parent 3eded2c146
commit 8b02aff629
2 changed files with 13 additions and 11 deletions

View file

@ -6,7 +6,7 @@ on:
jobs: jobs:
approve: approve:
if: !github.event.issue.pull_request if: ${{ !github.event.issue.pull_request }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write

View file

@ -62,16 +62,18 @@ jobs:
// Not approved - close PR with comment // Not approved - close PR with comment
console.log(`${prAuthor} is not approved, closing PR`); console.log(`${prAuthor} is not approved, closing PR`);
const message = `Hi @${prAuthor}, thanks for your interest in contributing! const message = [
`Hi @${prAuthor}, thanks for your interest in contributing!`,
We ask new contributors to open an issue first before submitting a PR. This helps us discuss the approach and avoid wasted effort. '',
'We ask new contributors to open an issue first before submitting a PR. This helps us discuss the approach and avoid wasted effort.',
**Next steps:** '',
1. Open an issue describing what you want to change and why (keep it concise, write in your human voice, AI slop will be closed) '**Next steps:**',
2. Once a maintainer approves with \`lgtm\`, you'll be added to the approved contributors list '1. Open an issue describing what you want to change and why (keep it concise, write in your human voice, AI slop will be closed)',
3. Then you can submit your PR '2. Once a maintainer approves with `lgtm`, you\'ll be added to the approved contributors list',
'3. Then you can submit your PR',
This PR will be closed automatically. See https://github.com/${context.repo.owner}/${context.repo.repo}/blob/${defaultBranch}/CONTRIBUTING.md for more details.`; '',
`This PR will be closed automatically. See https://github.com/${context.repo.owner}/${context.repo.repo}/blob/${defaultBranch}/CONTRIBUTING.md for more details.`
].join('\n');
await github.rest.issues.createComment({ await github.rest.issues.createComment({
owner: context.repo.owner, owner: context.repo.owner,