Skip to content

Commit

Permalink
give labeler its own pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Jan 22, 2024
1 parent 7feb2af commit 9e45a38
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ops:
- .identity/**

docs:
- README.md
- README.md
File renamed without changes.
26 changes: 26 additions & 0 deletions .github/workflows/pr_labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: PR - Labeler

on:
workflow_dispatch:

pull_request:
branches:
- main
- releases/**
types:
- opened
- synchronize

permissions:
contents: read
pull-requests: write

jobs:
labeler:
name: PR Labeler
runs-on: ubuntu-20.04

steps:
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5
with:
sync-labels: true
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
name: Check PR
name: PR - Validation

# Controls when the workflow will run
on:
workflow_dispatch:

pull_request:
branches:
- main
- releases/**
types:
- opened
- synchronize
- reopened

permissions:
pull-requests: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

labeler:
name: Add label to PR based on the paths of files being changed
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # pin@v4

check_pr_size:
name: Check PR size doesn't break set limit
runs-on: ubuntu-latest
validate_pr_size:
name: Ensure PR is small
runs-on: ubuntu-20.04
steps:
# checkout your code with your git history
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
name: Checkout
with:
fetch-depth: 0

- name: Get total lines changed
shell: bash
run: |
size=$(git diff --stat origin/main --diff-filter=d \
| grep -v .lock \
Expand All @@ -45,12 +37,13 @@ jobs:
echo ""
echo "Total lines changed (note: *.lock files are excluded from this count): "
echo $size
- name: Evaluate Lines Changed
shell: bash
- run: |
run: |
if [[ $size -gt 500 ]]
then
echo "Warning - total lines changed is greater than 500."
echo "Please consider breaking this PR down."
exit 1
fi
shell: bash

0 comments on commit 9e45a38

Please sign in to comment.