| 1 | name: Check for dependency changes |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | types: [opened, synchronize, reopened] |
| 6 | |
| 7 | permissions: |
| 8 | contents: read |
| 9 | pull-requests: write |
| 10 | |
| 11 | jobs: |
| 12 | compare-overrides: |
| 13 | runs-on: ubuntu-24.04 |
| 14 | |
| 15 | steps: |
| 16 | - uses: actions/checkout@v4 |
| 17 | with: |
| 18 | fetch-depth: 0 |
| 19 | ref: ${{ github.event.pull_request.head.sha }} |
| 20 | |
| 21 | - uses: actions/setup-go@v5 |
| 22 | with: |
| 23 | go-version: stable |
| 24 | |
| 25 | - name: Compare pubspec overrides |
| 26 | id: compare |
| 27 | env: |
| 28 | BASE_REF: ${{ github.event.pull_request.base.ref }} |
| 29 | run: | |
| 30 | git fetch origin "$BASE_REF" |
| 31 | base_sha=$(git rev-parse "origin/$BASE_REF") |
| 32 | head_sha="${{ github.event.pull_request.head.sha }}" |
| 33 | |
| 34 | ./scripts/compare_overrides.sh "$base_sha" "$head_sha" > /tmp/compare_output.txt |
| 35 | |
| 36 | if [[ ! -s /tmp/compare_output.txt ]]; then |
| 37 | echo "has_output=false" >> "$GITHUB_OUTPUT" |
| 38 | exit 0 |
| 39 | fi |
| 40 | |
| 41 | { |
| 42 | echo '### changes in dependencies' |
| 43 | echo |
| 44 | echo '```' |
| 45 | cat /tmp/compare_output.txt |
| 46 | echo '```' |
| 47 | } > /tmp/comment_body.md |
| 48 | |
| 49 | echo "has_output=true" >> "$GITHUB_OUTPUT" |
| 50 | |
| 51 | - uses: marocchino/sticky-pull-request-comment@v2 |
| 52 | if: steps.compare.outputs.has_output == 'true' |
| 53 | with: |
| 54 | header: pubspec-overrides-compare |
| 55 | path: /tmp/comment_body.md |