mirror of
https://github.com/bitwarden/server.git
synced 2025-05-20 19:14:32 -05:00
[DEVOPS-862] Update logic to workflow (#2194)
This commit is contained in:
parent
308ae7641b
commit
61f4a27d2b
6
.github/workflows/enforce-labels.yml
vendored
6
.github/workflows/enforce-labels.yml
vendored
@ -4,6 +4,10 @@ name: Enforce PR labels
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [labeled, unlabeled, opened, edited, synchronize]
|
types: [labeled, unlabeled, opened, edited, synchronize]
|
||||||
|
workflow_run:
|
||||||
|
workflows: [Protect Files]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
enforce-label:
|
enforce-label:
|
||||||
name: EnforceLabel
|
name: EnforceLabel
|
||||||
@ -12,5 +16,5 @@ jobs:
|
|||||||
- name: Enforce Label
|
- name: Enforce Label
|
||||||
uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024
|
uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024
|
||||||
with:
|
with:
|
||||||
BANNED_LABELS: "hold, DB migrations changed"
|
BANNED_LABELS: "hold,DB-migrations-changed"
|
||||||
BANNED_LABELS_DESCRIPTION: "PRs with ${bannedLabel.name} label cannot be merged"
|
BANNED_LABELS_DESCRIPTION: "PRs with ${bannedLabel.name} label cannot be merged"
|
||||||
|
34
.github/workflows/protect-files.yml
vendored
34
.github/workflows/protect-files.yml
vendored
@ -7,10 +7,11 @@ name: Protect Files
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- synchronize
|
- synchronize
|
||||||
paths:
|
- unlabeled
|
||||||
|
paths:
|
||||||
- "util/Migrator/DbScripts/**.sql"
|
- "util/Migrator/DbScripts/**.sql"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -18,7 +19,7 @@ jobs:
|
|||||||
name: Check for file changes
|
name: Check for file changes
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
outputs:
|
outputs:
|
||||||
changes: steps.check-changes.outputs.changes_detected
|
changes: ${{steps.check-changes.outputs.changes_detected}}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
@ -26,34 +27,29 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- name: Database Scripts
|
- name: Database Scripts
|
||||||
path: util/Migrator/DbScripts
|
path: util/Migrator/DbScripts
|
||||||
label: "DB migrations changed"
|
label: "DB-migrations-changed"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout PR
|
- name: Checkout repo
|
||||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Check for file changes
|
- name: Check for file changes
|
||||||
id: check-changes
|
id: check-changes
|
||||||
run: |
|
run: |
|
||||||
MODIFIED_FILES=$(git diff --name-only --diff-filter=M ${GITHUB_BASE_REF})
|
MODIFIED_FILES=$(git diff --name-only --diff-filter=M HEAD~1)
|
||||||
|
|
||||||
for file in $MODIFIED_FILES; do
|
for file in $MODIFIED_FILES
|
||||||
if [[ $file == *"${{ matrix.path }}"*]]; then
|
do
|
||||||
echo "::set-output name=changes_detected::'true'"
|
if [[ $file == *"${{ matrix.path }}"* ]]; then
|
||||||
|
echo "::set-output name=changes_detected::true"
|
||||||
break
|
break
|
||||||
else echo "::set-output name=changes_detected::'false'"
|
else echo "::set-output name=changes_detected::false"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
label-pr:
|
- name: Add label to pull request
|
||||||
name: Add label to pull request
|
if: contains(steps.check-changes.outputs.changes_detected, true)
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
needs:
|
|
||||||
- changed-files
|
|
||||||
if: needs.changed-files.outputs.changes == "true" || job.changed-files.status == "failure"
|
|
||||||
steps:
|
|
||||||
- name: Label PR
|
|
||||||
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
|
uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90
|
||||||
with:
|
with:
|
||||||
add-labels: ${{ matrix.label }}
|
add-labels: ${{ matrix.label }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user