|
| 1 | +name: sync-data |
| 2 | +on: |
| 3 | + schedule: [{ cron: "43 5 * * 2" }] |
| 4 | + workflow_dispatch: |
| 5 | +permissions: {} |
| 6 | +concurrency: { group: sync-data, cancel-in-progress: false } |
| 7 | +jobs: |
| 8 | + sync: |
| 9 | + runs-on: ubuntu-24.04 |
| 10 | + timeout-minutes: 20 |
| 11 | + permissions: { contents: write, pull-requests: write, issues: write, actions: write } |
| 12 | + env: { OK_VENDOR: real } |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 15 | + with: { persist-credentials: false } |
| 16 | + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 |
| 17 | + with: { version: "0.11.7", enable-cache: false } |
| 18 | + - run: uv sync --frozen |
| 19 | + - run: mkdir -p _reports |
| 20 | + - run: uv run python -m opsite sync-data --from pages |
| 21 | + - id: build |
| 22 | + continue-on-error: true |
| 23 | + run: | |
| 24 | + uv run python -m opsite build |
| 25 | + uv run python -m opsite check --ci |
| 26 | + - name: report |
| 27 | + env: |
| 28 | + BUILD_OK: ${{ steps.build.outcome == 'success' }} |
| 29 | + run: uv run python -m pipeline.sync_report --build-ok "$BUILD_OK" |
| 30 | + - id: meta |
| 31 | + run: | |
| 32 | + echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT" |
| 33 | + echo "labels=$(jq -r '.labels | join(",")' _reports/sync.json)" >> "$GITHUB_OUTPUT" |
| 34 | + if [ -n "$(git status --porcelain -- vendor deps.yaml)" ]; then echo "changed=true" >> "$GITHUB_OUTPUT"; else echo "changed=false" >> "$GITHUB_OUTPUT"; fi |
| 35 | + - name: upstream |
| 36 | + if: steps.meta.outputs.changed == 'true' |
| 37 | + run: uv run python -m pipeline.upstream |
| 38 | + - id: pr |
| 39 | + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 |
| 40 | + with: |
| 41 | + branch: sync/${{ steps.meta.outputs.date }} |
| 42 | + title: "data: снимки соседей ${{ steps.meta.outputs.date }}" |
| 43 | + commit-message: "data: снимки соседей ${{ steps.meta.outputs.date }}" |
| 44 | + body: "Новые снимки pal-norms и pal-directory. Сборка: ${{ steps.build.outcome }}. Проверьте, что документы собираются и даты ответа не сдвинулись без причины. Подробности в _reports/sync.json артефакта sync-reports" |
| 45 | + labels: ${{ steps.meta.outputs.labels }} |
| 46 | + add-paths: | |
| 47 | + vendor/** |
| 48 | + deps.yaml |
| 49 | + data/snapshots/upstream.json |
| 50 | + - name: checks on the pull request |
| 51 | + if: steps.pr.outputs.pull-request-operation == 'created' || steps.pr.outputs.pull-request-operation == 'updated' |
| 52 | + env: |
| 53 | + GH_TOKEN: ${{ github.token }} |
| 54 | + GH_REPO: ${{ github.repository }} |
| 55 | + BRANCH: ${{ steps.pr.outputs.pull-request-branch }} |
| 56 | + run: gh workflow run checks.yml --ref "$BRANCH" |
| 57 | + - name: issues |
| 58 | + if: ${{ !cancelled() }} |
| 59 | + env: |
| 60 | + GH_TOKEN: ${{ github.token }} |
| 61 | + GH_REPO: ${{ github.repository }} |
| 62 | + run: uv run python -m pipeline.issues _reports/sync.json |
| 63 | + - if: always() |
| 64 | + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 |
| 65 | + with: { name: sync-reports, path: _reports, if-no-files-found: ignore } |
| 66 | + - name: keepalive |
| 67 | + if: always() |
| 68 | + env: |
| 69 | + GH_TOKEN: ${{ github.token }} |
| 70 | + run: gh api -X PUT "repos/$GITHUB_REPOSITORY/actions/workflows/sync-data.yml/enable" |
| 71 | + review-due: |
| 72 | + runs-on: ubuntu-24.04 |
| 73 | + timeout-minutes: 10 |
| 74 | + permissions: { contents: read, issues: write } |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 77 | + with: { persist-credentials: false } |
| 78 | + - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 |
| 79 | + with: { version: "0.11.7", enable-cache: false } |
| 80 | + - run: uv sync --frozen |
| 81 | + - id: when |
| 82 | + run: if [ "$(date -u +%d)" -le 7 ]; then echo "monthly=true" >> "$GITHUB_OUTPUT"; else echo "monthly=false" >> "$GITHUB_OUTPUT"; fi |
| 83 | + - if: steps.when.outputs.monthly == 'true' || github.event_name == 'workflow_dispatch' |
| 84 | + run: uv run python -m pipeline.review_due |
| 85 | + - if: steps.when.outputs.monthly == 'true' || github.event_name == 'workflow_dispatch' |
| 86 | + env: |
| 87 | + GH_TOKEN: ${{ github.token }} |
| 88 | + GH_REPO: ${{ github.repository }} |
| 89 | + run: uv run python -m pipeline.issues _reports/review.json |
0 commit comments