block-outdated-3rdparty.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: MIT
  3. name: Block merging with outdated 3rdparty/
  4. on:
  5. pull_request:
  6. types: [opened, ready_for_review, reopened, synchronize]
  7. permissions:
  8. contents: read
  9. concurrency:
  10. group: block-outdated-3rdparty-${{ github.head_ref || github.run_id }}
  11. cancel-in-progress: true
  12. jobs:
  13. block-outdated-3rdparty:
  14. name: Block merging with outdated 3rdparty/
  15. runs-on: ubuntu-latest-low
  16. steps:
  17. - name: Check requirement
  18. uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  19. id: changes
  20. continue-on-error: true
  21. with:
  22. filters: |
  23. src:
  24. - '3rdparty'
  25. - 'version.php'
  26. - name: Checkout
  27. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  28. - name: 3rdparty commit hash on current branch
  29. id: actual
  30. run: |
  31. echo "commit=$(git submodule status | grep ' 3rdparty' | egrep -o '[a-f0-9]{40}')" >> "$GITHUB_OUTPUT"
  32. - name: Last 3rdparty commit on target branch
  33. id: target
  34. run: |
  35. echo "commit=$(git ls-remote https://github.com/nextcloud/3rdparty refs/heads/${{ github.base_ref }} | awk '{ print $1}')" >> "$GITHUB_OUTPUT"
  36. - name: Compare if 3rdparty commits are different
  37. run: |
  38. echo '3rdparty/ seems to not point to the last commit of the dedicated branch:'
  39. echo 'Branch has: ${{ steps.actual.outputs.commit }}'
  40. echo '${{ github.base_ref }} has: ${{ steps.target.outputs.commit }}'
  41. - name: Fail if 3rdparty commits are different
  42. if: ${{ steps.changes.outputs.src != 'false' && steps.actual.outputs.commit != steps.target.outputs.commit }}
  43. run: |
  44. exit 1