feat: add functionality for moderator to create healthcare professional #1251
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: Lint Locales | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
schedule: | |
- cron: '45 15 * * 4' | |
permissions: | |
contents: read | |
pull-requests: write | |
actions: write # Ensure actions permissions are set to write | |
jobs: | |
locale-lint: | |
name: Linting Locales 😎 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [21.3.0] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install Node.js and Yarn | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Run Locales Lint | |
id: lint | |
run: | | |
NODE_ENV=production node i18n/checkLocaleKeys.js --report-only > missing_keys.txt | |
if [ -s missing_keys.txt ]; then | |
cat missing_keys.txt | |
exit 1 | |
fi | |
- name: Create Comment for Triggering Auto Fix | |
if: failure() | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
// Read missing keys from the file | |
const missingKeysContent = fs.readFileSync('missing_keys.txt', 'utf8').trim(); | |
const missingKeys = missingKeysContent ? missingKeysContent.split('\n') : []; | |
if (missingKeys.length === 0) { | |
console.log('No missing keys found.'); | |
return; | |
} | |
const formattedKeys = missingKeys.map(key => key.trim() && !key.includes("json") ? `- ${key}` : `**${key}**`).join('\n'); | |
const repo = context.repo.repo; | |
const owner = context.repo.owner; | |
const commentBody = `### Missing Locale Keys Found: \n${formattedKeys}\n\n### To add the missing keys, check the following box:\n\n\- [ ] Update and commit missing keys in locale files`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner, | |
repo, | |
body: commentBody | |
}); |