Social publish #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
| # .github/workflows/social-publish.yaml | |
| name: Social publish | |
| on: | |
| schedule: | |
| # Dwa slotów publikacji: 9:00 i 17:00 Europe/Warsaw — każdy dostaje OKNO, | |
| # nie jeden punkt. Dwa wpisy pokrywają CET (UTC+1) i CEST (UTC+2), trzeci jest | |
| # zapasem, bo GitHub traktuje `schedule` najniższym priorytetem: pomiary | |
| # 18-21.09.2026 dały opóźnienia +1h43 do +5h34 i tylko 2 z 4 zaplanowanych | |
| # zdarzeń. O tym, co jest due, decyduje skrypt w strefie Europe/Warsaw, | |
| # a status.json gwarantuje brak podwójnych publikacji przy nadmiarowym runie. | |
| # Żaden wpis nie wypada PRZED slotem — run przed czasem nie ma nic do zrobienia | |
| # i przesunąłby post na kolejne okno. | |
| - cron: "0 7,8,9 * * *" | |
| - cron: "0 15,16,17 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: social-publish | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| publish: | |
| # Bezpiecznik ze specu: publikacja wyłącznie z main (akceptacja = commit/merge). | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: uv sync --frozen --no-dev | |
| - name: Publish due posts | |
| run: uv run pyldz social publish | |
| env: | |
| META_PAGE_ID: ${{ secrets.META_PAGE_ID }} | |
| META_ACCESS_TOKEN: ${{ secrets.META_ACCESS_TOKEN }} | |
| IG_USER_ID: ${{ secrets.IG_USER_ID }} | |
| DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| - name: Commit publish status | |
| # always(): częściowy sukces też musi wylądować w status.json, | |
| # inaczej kolejny run opublikowałby posty drugi raz. | |
| if: always() | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add page/content/spotkania/*/social/status.json | |
| if ! git diff --cached --quiet; then | |
| git commit -m "social: update publish status [skip ci]" | |
| git pull --rebase origin main | |
| git push origin main | |
| fi |