block-merge-eol.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. #
  6. # SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
  7. # SPDX-License-Identifier: MIT
  8. name: Block merges for EOL
  9. on: pull_request
  10. permissions:
  11. contents: read
  12. concurrency:
  13. group: block-merge-eol-${{ github.head_ref || github.run_id }}
  14. cancel-in-progress: true
  15. jobs:
  16. block-merges-eol:
  17. name: Block merges for EOL branches
  18. # Only run on stableXX branches
  19. if: startsWith( github.base_ref, 'stable')
  20. runs-on: ubuntu-latest-low
  21. steps:
  22. - name: Set server major version environment
  23. run: |
  24. # retrieve version number from branch reference
  25. server_major=$(echo "${{ github.base_ref }}" | sed -En 's/stable//p')
  26. echo "server_major=$server_major" >> $GITHUB_ENV
  27. echo "current_month=$(date +%Y-%m)" >> $GITHUB_ENV
  28. - name: Checking if ${{ env.server_major }} is EOL
  29. run: |
  30. curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json \
  31. | jq '.["${{ env.server_major }}"]["eol"] // "9999-99" | . >= "${{ env.current_month }}"' \
  32. | grep -q true