|
| 1 | +name: Update Solutions Analyzer CSV Files |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - 'Solutions/**/*.json' |
| 9 | + - 'Solutions/**/Parsers/**/*.yaml' |
| 10 | + - 'Solutions/**/Parsers/**/*.yml' |
| 11 | + - 'Tools/Solutions Analyzer/solution_connector_tables.py' |
| 12 | + workflow_dispatch: # Allow manual trigger |
| 13 | + schedule: |
| 14 | + # Run weekly on Monday at 2 AM UTC to catch any missed changes |
| 15 | + - cron: '0 2 * * 1' |
| 16 | + |
| 17 | +jobs: |
| 18 | + update-csv: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + permissions: |
| 21 | + contents: write |
| 22 | + pull-requests: write |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: Set up Python |
| 31 | + uses: actions/setup-python@v5 |
| 32 | + with: |
| 33 | + python-version: '3.11' |
| 34 | + |
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + pip install json5 |
| 38 | + |
| 39 | + - name: Run Solutions Analyzer |
| 40 | + run: | |
| 41 | + cd "Tools/Solutions Analyzer" |
| 42 | + python solution_connector_tables.py |
| 43 | + |
| 44 | + - name: Generate Connector Documentation |
| 45 | + run: | |
| 46 | + cd "Tools/Solutions Analyzer" |
| 47 | + python generate_connector_docs.py |
| 48 | + |
| 49 | + - name: Check for changes |
| 50 | + id: check_changes |
| 51 | + run: | |
| 52 | + if git diff --quiet "Tools/Solutions Analyzer/solutions_connectors_tables_mapping.csv" "Tools/Solutions Analyzer/solutions_connectors_tables_issues_and_exceptions_report.csv" "Tools/Solutions Analyzer/connector-docs/"; then |
| 53 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 54 | + else |
| 55 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 56 | + fi |
| 57 | + |
| 58 | + - name: Create Pull Request |
| 59 | + if: steps.check_changes.outputs.changed == 'true' |
| 60 | + id: create_pr |
| 61 | + uses: peter-evans/create-pull-request@v6 |
| 62 | + with: |
| 63 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + commit-message: 'chore: Update Solutions Analyzer CSV files and documentation' |
| 65 | + branch: solutions-analyzer-update |
| 66 | + delete-branch: true |
| 67 | + title: 'chore: Update Solutions Analyzer CSV files and documentation' |
| 68 | + body: | |
| 69 | + ## Automated Solutions Analyzer Update |
| 70 | + |
| 71 | + This PR contains automated updates to: |
| 72 | + - Solutions connector-to-tables mapping CSV |
| 73 | + - Solutions issues and exceptions report CSV |
| 74 | + - Connector documentation files |
| 75 | + |
| 76 | + Generated by the Solutions Analyzer workflow. |
| 77 | + |
| 78 | + **Triggered by:** ${{ github.event_name }} |
| 79 | + **Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| 80 | + labels: automated, documentation |
| 81 | + add-paths: | |
| 82 | + Tools/Solutions Analyzer/solutions_connectors_tables_mapping.csv |
| 83 | + Tools/Solutions Analyzer/solutions_connectors_tables_issues_and_exceptions_report.csv |
| 84 | + Tools/Solutions Analyzer/connector-docs/ |
| 85 | + |
| 86 | + - name: Enable auto-merge |
| 87 | + if: steps.check_changes.outputs.changed == 'true' && steps.create_pr.outputs.pull-request-number != '' |
| 88 | + run: | |
| 89 | + gh pr merge ${{ steps.create_pr.outputs.pull-request-number }} --auto --squash |
| 90 | + env: |
| 91 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + |
| 93 | + - name: Create summary |
| 94 | + if: steps.check_changes.outputs.changed == 'true' |
| 95 | + run: | |
| 96 | + echo "### Solutions Analyzer Pull Request Created :white_check_mark:" >> $GITHUB_STEP_SUMMARY |
| 97 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 98 | + echo "A pull request has been created with updated CSV files and documentation." >> $GITHUB_STEP_SUMMARY |
| 99 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 100 | + echo "**Modified files:**" >> $GITHUB_STEP_SUMMARY |
| 101 | + echo "- Tools/Solutions Analyzer/solutions_connectors_tables_mapping.csv" >> $GITHUB_STEP_SUMMARY |
| 102 | + echo "- Tools/Solutions Analyzer/solutions_connectors_tables_issues_and_exceptions_report.csv" >> $GITHUB_STEP_SUMMARY |
| 103 | + echo "- Tools/Solutions Analyzer/connector-docs/" >> $GITHUB_STEP_SUMMARY |
| 104 | + |
| 105 | + - name: No changes summary |
| 106 | + if: steps.check_changes.outputs.changed == 'false' |
| 107 | + run: | |
| 108 | + echo "### Solutions Analyzer :information_source:" >> $GITHUB_STEP_SUMMARY |
| 109 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 110 | + echo "No changes detected. CSV files and documentation are already up-to-date." >> $GITHUB_STEP_SUMMARY |
0 commit comments