|
| 1 | +name: Auto-diff PDF files |
| 2 | + |
| 3 | +# only trigger on opened/reopened/updated PRs that change the schematic |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request: |
| 7 | + types: |
| 8 | + - opened |
| 9 | + - reopened |
| 10 | + - synchronize |
| 11 | + # paths: |
| 12 | + # - '**.kicad_sch' |
| 13 | + |
| 14 | +jobs: |
| 15 | + diff_pdfs: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + name: Render diffs of schematics |
| 18 | + steps: |
| 19 | + - name: Checkout target branch - ${{ github.base_ref }} |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + ref: ${{ github.base_ref }} |
| 23 | + path: target |
| 24 | + |
| 25 | + - name: Checkout source branch - ${{ github.head_ref }} |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: ${{ github.head_ref }} |
| 29 | + path: source |
| 30 | + |
| 31 | + - name: Export target branch schematic PDF |
| 32 | + id: target |
| 33 | + uses: sparkengineering/kicad-action@v2 |
| 34 | + if: '!cancelled()' |
| 35 | + with: |
| 36 | + kicad_sch: target/Chassis/Chassis.kicad_sch |
| 37 | + sch_pdf: true |
| 38 | + sch_pdf_file: target_Chassis.pdf |
| 39 | + |
| 40 | + - name: Upload target schematic PDF |
| 41 | + uses: actions/upload-artifact@v4 |
| 42 | + if: ${{ !cancelled() && steps.target.conclusion == 'success' }} |
| 43 | + with: |
| 44 | + name: target_Chassis.pdf |
| 45 | + path: target/Chassis/target_Chassis.pdf |
| 46 | + |
| 47 | + - name: Export source branch schematic PDF |
| 48 | + id: source |
| 49 | + uses: sparkengineering/kicad-action@v2 |
| 50 | + if: '!cancelled()' |
| 51 | + with: |
| 52 | + kicad_sch: source/Chassis/Chassis.kicad_sch |
| 53 | + sch_pdf: true |
| 54 | + sch_pdf_file: source_Chassis.pdf |
| 55 | + |
| 56 | + - name: Upload source schematic PDF |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + if: ${{ !cancelled() && steps.source.conclusion == 'success' }} |
| 59 | + with: |
| 60 | + name: source_Chassis.pdf |
| 61 | + path: source/Chassis/source_Chassis.pdf |
| 62 | + |
| 63 | + - name: Compare PDFs |
| 64 | + id: compare |
| 65 | + uses: nowsprinting/diff-pdf-action@v1 |
| 66 | + if: ${{ !cancelled() && !failure() }} |
| 67 | + with: |
| 68 | + file1: source/Chassis/source_Chassis.pdf |
| 69 | + file2: target/Chassis/target_Chassis.pdf |
| 70 | + options: -s -m --output-diff=diff.pdf --dpi=300 |
| 71 | + suppress-diff-error: true |
| 72 | + |
| 73 | + - name: Upload diff PDF |
| 74 | + uses: actions/upload-artifact@v4 |
| 75 | + if: ${{ !cancelled() && steps.compare.conclusion == 'success' }} |
| 76 | + with: |
| 77 | + name: diff.pdf |
| 78 | + path: diff.pdf |
0 commit comments