Update docs form validation example to demonstrate best-practise when submitting a form in an invalid state #752
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: Release conductor checklist | |
on: | |
pull_request: | |
jobs: | |
release-template: | |
if: ${{ github.head_ref == 'changeset-release/main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Get or Create Comment | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs') | |
const body = await fs.readFileSync('.github/release_template.md', 'utf8') | |
const result = await github.rest.issues.listComments({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo | |
}); | |
if (!result.data.some(comment => comment.body.startsWith('## ❗ Pre-merge checklist'))) { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body.replace('{{PR_AUTHOR}}', context.payload.sender.login) | |
}) | |
} | |