ajustar foto Erica #15
This file contains hidden or 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: Sync Issues to JSON | |
| on: | |
| issues: | |
| types: [opened, edited, closed] | |
| permissions: | |
| contents: write | |
| issues: read | |
| concurrency: | |
| group: sync-issues-${{ github.event.issue.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| sync-issues: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Create issues directory if not exists | |
| run: mkdir -p public/data | |
| - name: Sync issue to JSON | |
| env: | |
| ISSUE_JSON: ${{ toJSON(github.event.issue) }} | |
| ISSUE_ACTION: ${{ github.event.action }} | |
| OUTPUT_PATH: public/data/issues.json | |
| run: node scripts/sync-issue.js | |
| - name: Commit and push changes | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| if [[ -n $(git status --porcelain) ]]; then | |
| git add public/data/issues.json | |
| git commit -m "🤖 Sync issue #${{ github.event.issue.number }} (${{ github.event.action }})" | |
| git pull --rebase origin main | |
| git push | |
| echo "✅ Cambios commiteados y pusheados" | |
| else | |
| echo "ℹ️ No hay cambios para commitear" | |
| fi | |
| - name: Save issues.json to temp before switching branch | |
| run: cp public/data/issues.json /tmp/issues.json | |
| - name: Push issues.json to gh-pages | |
| run: | | |
| git fetch origin gh-pages | |
| git checkout gh-pages | |
| mkdir -p data | |
| cp /tmp/issues.json data/issues.json | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| if [[ -n $(git status --porcelain data/issues.json) ]]; then | |
| git add data/issues.json | |
| git commit -m "🤖 Sync issue #${{ github.event.issue.number }} (${{ github.event.action }}) [gh-pages]" | |
| git push origin gh-pages | |
| echo "✅ issues.json actualizado en gh-pages" | |
| else | |
| echo "ℹ️ No hay cambios para commitear en gh-pages" | |
| fi |