-
Notifications
You must be signed in to change notification settings - Fork 73
58 lines (50 loc) · 1.88 KB
/
Copy pathblock-merge-eol.yml
File metadata and controls
58 lines (50 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Block merge to EOL
on: pull_request
permissions:
contents: read
concurrency:
group: block-merge-eol-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
block-eol:
name: Block merge to EOL
runs-on: ubuntu-latest-low
steps:
- name: Parse base branch version
id: parse
run: |
branch="${{ github.base_ref }}"
if [[ $branch =~ ^stable([0-9]+)$ ]]; then
echo "major=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
- name: Get current date
if: ${{ !steps.parse.outputs.skip }}
id: date
run: echo "date=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Fetch EOL data
if: ${{ !steps.parse.outputs.skip }}
id: eol
run: |
data=$(curl -s https://raw.githubusercontent.com/nextcloud-releases/updater_server/production/config/major_versions.json)
eol=$(echo "$data" | jq -r ".[] | select(.majorVersion == ${{ steps.parse.outputs.major }}) | .eol")
echo "eol=$eol" >> $GITHUB_OUTPUT
- name: Check EOL date
if: ${{ !steps.parse.outputs.skip }}
run: |
eol_date="${{ steps.eol.outputs.eol }}"
current_date="${{ steps.date.outputs.date }}"
if [[ "$eol_date" != "" && "$eol_date" != "null" ]]; then
if [[ "$eol_date" < "$current_date" || "$eol_date" == "$current_date" ]]; then
echo "This branch is EOL (End-of-Life) since $eol_date"
exit 1
fi
fi