Skip to content

Commit 0ecad04

Browse files
committed
update github workflows from cookie cutter
1 parent 1d9ff29 commit 0ecad04

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PR Check Label for version Label
1+
name: pull_request label
22

33
on:
44
pull_request:
@@ -12,17 +12,15 @@ jobs:
1212
check-labels:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Check for version label
15+
- name: pull_request label
1616
run: |
17-
echo "Checking for version label on pull request..."
17+
echo "Checking for label on pull request..."
1818
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
1919
LABEL_NAMES=$(echo "$PR_DATA" | jq -r '.labels[].name')
2020
echo "Labels: $LABEL_NAMES"
2121
22-
REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
23-
MATCHES=$(echo "$LABEL_NAMES" | grep -E "$REGEX")
24-
if [ -z "$MATCHES" ]; then
25-
echo "Error: No version label found on this pull request. Please add a label in the format vX.Y.Z."
22+
if [ -z "$LABEL_NAMES" ]; then
23+
echo "Error: No label found on this pull request. Please add a label."
2624
exit 1
2725
fi
2826
env:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: pull_request version milestone
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- labeled
8+
- unlabeled
9+
- synchronize
10+
11+
jobs:
12+
check-labels:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: pull_request version milestone
16+
run: |
17+
echo "Checking for version milestone on pull request..."
18+
PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }})
19+
MILESTONE_NAME=$(echo "$PR_DATA" | jq -r '.milestone.title')
20+
echo "Milestone: $MILESTONE_NAME"
21+
22+
REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
23+
MATCHES=$(echo "$MILESTONE_NAME" | grep -E "$REGEX")
24+
if [ -z "$MATCHES" ]; then
25+
echo "Error: No version milestone found on this pull request. Please add a milestone in the format vX.Y.Z."
26+
exit 1
27+
fi
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)