-
Notifications
You must be signed in to change notification settings - Fork 5.1k
59 lines (48 loc) · 1.76 KB
/
copyright-check.yml
File metadata and controls
59 lines (48 loc) · 1.76 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
59
name: Detect Unexpected EE Changes
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
check-copyright-and-ee-files:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@c6295a65d1254861815972266d5933fd6e532bdf # v2.11.1
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@v4
- name: Find Enterprise Copyright
shell: bash
run: |
set -e
workflow_file=$(grep -rnl "^name:[[:space:]]*Detect Unexpected EE Changes" .github/workflows/*.yml | head -n1)
echo "Detected workflow file: $workflow_file"
all_files=$(grep -r -F -l "This software is copyright Kong Inc. and its licensors." .)
# ignore this file
files=$(echo "$all_files" | grep -v "$workflow_file$" || true)
if [ -n "$files" ]; then
echo "Error: Enterprise copyright detected in the following files:"
echo "$files"
exit 1
else
echo "No enterprise copyright found."
fi
- name: Get changed EE files
id: changed-ee-files
uses: kong/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf
with:
files: |
spec-ee/**
plugins-ee/**
kong/enterprise_edition/**
kong/plugins/*-advanced/**
changelog/**/*-ee/**
- name: Detect EE files
if: steps.changed-ee-files.outputs.any_changed == 'true'
run: |
echo "The following unexpected EE files were detected:"
echo "${{ steps.changed-ee-files.outputs.all_changed_files }}"
exit 1