|
| 1 | +name: Update Platform Components Table |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: update-platform-components |
| 11 | + cancel-in-progress: false |
| 12 | + |
| 13 | +env: |
| 14 | + PYTHON_VERSION: "3.11" |
| 15 | + OUTPUT_FILE: docs-website/docs/overview/platform-components.mdx |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + update: |
| 22 | + runs-on: ubuntu-slim |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout deepset-ai/haystack |
| 26 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 27 | + with: |
| 28 | + token: ${{ secrets.HAYSTACK_BOT_TOKEN }} |
| 29 | + # Full history so git diff against HEAD works correctly |
| 30 | + fetch-depth: 0 |
| 31 | + |
| 32 | + - name: Checkout deepset-ai/haystack-core-integrations |
| 33 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 34 | + with: |
| 35 | + repository: deepset-ai/haystack-core-integrations |
| 36 | + path: haystack-core-integrations |
| 37 | + fetch-depth: 1 |
| 38 | + sparse-checkout: integrations |
| 39 | + sparse-checkout-cone-mode: true |
| 40 | + |
| 41 | + - name: Checkout platform repo (sparse — schema file only) |
| 42 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 43 | + with: |
| 44 | + repository: ${{ secrets.SCHEMA_REPO }} |
| 45 | + token: ${{ secrets.PLATFORM_REPO_PAT }} |
| 46 | + path: platform-repo |
| 47 | + sparse-checkout: | |
| 48 | + ${{ secrets.SCHEMA_REPO_PATH }} |
| 49 | + sparse-checkout-cone-mode: false |
| 50 | + |
| 51 | + - name: Set up Python ${{ env.PYTHON_VERSION }} |
| 52 | + uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 |
| 53 | + with: |
| 54 | + python-version: "${{ env.PYTHON_VERSION }}" |
| 55 | + |
| 56 | + - name: Generate platform components table |
| 57 | + run: | |
| 58 | + python scripts/generate_platform_components_table.py \ |
| 59 | + --haystack-src . \ |
| 60 | + --integrations-src ./haystack-core-integrations \ |
| 61 | + --schema ./platform-repo/${{ secrets.SCHEMA_REPO_PATH }} \ |
| 62 | + --output ./${{ env.OUTPUT_FILE }} |
| 63 | +
|
| 64 | + - name: Compute PR body |
| 65 | + id: pr_body |
| 66 | + run: | |
| 67 | + FILE="${{ env.OUTPUT_FILE }}" |
| 68 | + if git ls-files --error-unmatch "$FILE" 2>/dev/null; then |
| 69 | + ADDED=$(git diff HEAD -- "$FILE" | grep -cE '^\+\| `' || true) |
| 70 | + REMOVED=$(git diff HEAD -- "$FILE" | grep -cE '^\-\| `' || true) |
| 71 | + SUMMARY="Component rows changed: **+${ADDED}** added, **-${REMOVED}** removed." |
| 72 | + else |
| 73 | + SUMMARY="Initial generation of the platform components table." |
| 74 | + fi |
| 75 | +
|
| 76 | + { |
| 77 | + echo "body<<EOF" |
| 78 | + echo "## Platform Components Table Update" |
| 79 | + echo "" |
| 80 | + echo "${SUMMARY}" |
| 81 | + echo "" |
| 82 | + echo "_Auto-generated by the [update-platform-components](https://github.com/deepset-ai/haystack/actions/workflows/update-platform-components.yml) workflow._" |
| 83 | + echo "EOF" |
| 84 | + } >> "$GITHUB_OUTPUT" |
| 85 | +
|
| 86 | + - name: Open or update pull request |
| 87 | + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 |
| 88 | + with: |
| 89 | + token: ${{ secrets.HAYSTACK_BOT_TOKEN }} |
| 90 | + commit-message: "chore: update platform components table [skip ci]" |
| 91 | + branch: chore/update-platform-components |
| 92 | + base: main |
| 93 | + title: "chore: update platform components table" |
| 94 | + add-paths: | |
| 95 | + ${{ env.OUTPUT_FILE }} |
| 96 | + body: ${{ steps.pr_body.outputs.body }} |
| 97 | + labels: | |
| 98 | + documentation |
| 99 | + ignore-for-release-notes |
0 commit comments