awesome-gpt-image-2/.github/workflows/sync-labels.yml
Jared Liu a00a14c74f feat: scaffold awesome-gpt-image-2 from nano-banana-pro template
Mirror of awesome-nano-banana-pro-prompts tuned for OpenAI's upcoming
GPT Image 2 (codename "duct-tape"):

- Swap CMS model filter to gpt-image-2 + campaign gpt-image-2-prompts
- i18n.ts: all 16 languages rebranded; rewrite seedancePromo to
  cross-promote nano-banana-pro, and whatIs content to reflect
  GPT Image 2's actual strengths:
    * Pixel-perfect multi-language text rendering (zh/en/ja)
    * Cross-image pixel-level consistency
    * Commercial-ready illustration quality
    * True art style induction
  Primary languages (en, zh, zh-TW, ja, ko) hand-translated;
  others fall back to English copy (will be refined later)
- markdown-generator: cover image path switched to
  gpt-image-2-prompts-cover-{en,zh}.png, arenaUrl points at the
  gallery page (the side-by-side arena page doesn't exist yet)
- GitHub Actions:
    * update-readme.yml runs on cron 0 0,12 * * * (twice daily
      per product request, instead of every 4 hours)
    * sync-approved-to-cms.yml wired to gpt-image-2 model
- Cover images, issue templates, docs, LICENSE (year 2026) updated
- Initial 16 README_*.md files generated from live CMS (78 prompts,
  44 categories) so the repo renders immediately without waiting
  for the first Action run

Secrets the repo needs before the Action runs on the remote:
  - CMS_HOST
  - CMS_API_KEY

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-20 14:42:24 +08:00

107 lines
3.6 KiB
YAML

name: Sync Labels
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '.github/labels.yml'
permissions:
issues: write
jobs:
sync-labels:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Sync labels
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
// Read labels.yml file
const labelsFile = fs.readFileSync('.github/labels.yml', 'utf8');
// Simple YAML parsing for array format
const lines = labelsFile.split('\n');
const labels = [];
let currentLabel = null;
for (const line of lines) {
const trimmed = line.trim();
if (trimmed.startsWith('- name:')) {
if (currentLabel) labels.push(currentLabel);
const nameMatch = trimmed.match(/- name:\s*(.+)/);
if (nameMatch) {
currentLabel = {
name: nameMatch[1].trim().replace(/^['"]|['"]$/g, ''),
color: '',
description: ''
};
}
} else if (trimmed.startsWith('color:')) {
if (currentLabel) {
const colorMatch = trimmed.match(/color:\s*(.+)/);
if (colorMatch) {
currentLabel.color = colorMatch[1].trim().replace(/^['"]|['"]$/g, '');
}
}
} else if (trimmed.startsWith('description:')) {
if (currentLabel) {
const descMatch = trimmed.match(/description:\s*(.+)/);
if (descMatch) {
currentLabel.description = descMatch[1].trim().replace(/^['"]|['"]$/g, '');
}
}
}
}
if (currentLabel) labels.push(currentLabel);
// Get existing labels
const existingLabels = await github.rest.issues.listLabelsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
});
const existingLabelNames = new Set(existingLabels.data.map(label => label.name));
// Sync labels
for (const label of labels) {
const labelName = label.name;
const labelColor = label.color.replace('#', '');
const labelDescription = label.description || '';
try {
if (existingLabelNames.has(labelName)) {
// Update existing label
await github.rest.issues.updateLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: labelName,
color: labelColor,
description: labelDescription,
});
console.log(`Updated label: ${labelName}`);
} else {
// Create new label
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: labelName,
color: labelColor,
description: labelDescription,
});
console.log(`Created label: ${labelName}`);
}
} catch (error) {
console.error(`Error syncing label ${labelName}:`, error.message);
}
}
console.log('Labels sync completed!');