Skip to content

it_IT.json

it_IT.json #323

Workflow file for this run

name: CI
on: pull_request
permissions:
pull-requests: write
issues: write
jobs:
ci:
runs-on: ubuntu-latest
name: CI
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/checkout@v3
with:
ref: master
path: old
- name: Run util validate
run: |
node .github/util.mjs validate old/index.json
mv .result.json .result.json.validate
- name: Run util merge
continue-on-error: true
run: |
cmp --silent ./en_US.json ./old/en_US.json || node .github/util.mjs merge
[ -f .result.json ] || exit 0
cat .result.json
mv .result.json .result.json.merge
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ./*.json
git commit -m "chore: merge translations" || exit 0
git push ${{ github.event.pull_request.head.repo.html_url }} ${{ github.event.pull_request.head.ref }}
- name: Post util validate
uses: actions/github-script@v7
with:
github-token: ${{ secrets.YIM_NPC_COMMENT_TOKEN }}
script: |
const fs = require('fs');
const process = require('process');
const result = JSON.parse(fs.readFileSync(".result.json.validate"));
if (fs.existsSync(".result.json.merge")) {
result.changed = [...result.changed, ...JSON.parse(fs.readFileSync(".result.json.merge")).changed];
}
if (result.changed?.length === 0 && result.errors?.length === 0 && result.warnings?.length === 0) process.exit(0)
const {owner, repo} = context.repo;
const pull_request = ${{ github.event.number }};
if (!pull_request) {
return core.error("This workflow doesn't match any pull requests!");
}
const labels = {
changed: "info",
warnings: "warning",
errors: "error"
}
const generate_md = (label, results) => results.length > 0 ? `<details><summary><picture><source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/f4116f5b4a31c72fcfdd5cb9869bb4ae2a2cf4a8/blockquotes/badge/light-theme/${label}.svg"><img alt="${label}" src="https://raw.githubusercontent.com/Mqxx/GitHub-Markdown/f4116f5b4a31c72fcfdd5cb9869bb4ae2a2cf4a8/blockquotes/badge/dark-theme/${label}.svg"></picture> (${results.length})</summary>\n\n\`\`\`\n${results.join("\n")}\n\`\`\`\n\n</details>` : ""
let body = [];
["changed", "warnings", "errors"].forEach(x => body.push(generate_md(labels[x], result[x])));
body = body.filter(x => x.length > 0);
await github.rest.issues.createComment({ owner, repo, issue_number: pull_request, body: body.join("\n") });