forked from stfc/cloud-deployed-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (64 loc) · 2.38 KB
/
pr_copied_files.yaml
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
60
61
62
63
64
65
66
67
68
name: CI Copied Files Check
on:
push:
branches:
- check_pr_copies
pull_request:
branches:
- main
jobs:
# ------------------------------------------------------------------------------------------------------------------------------------------------
# Event `pull_request`: Compare the last commit of the main branch or last remote commit of the PR branch -> to the current commit of a PR branch.
# ------------------------------------------------------------------------------------------------------------------------------------------------
changed_files:
runs-on: ubuntu-latest # windows-latest || macos-latest
name: Test changed-files
outputs:
check_result: ${{ steps.step1.outputs.result }}
steps:
- uses: actions/checkout@v4
with:
ref: check_pr_copies
- name: Get changed files in specific repo folders
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
- charts/staging/**
- charts/prod/**
- clusters/staging/**
- clusters/prod/**
- secrets/staging/**
- secrets/prod**
- name: Run step if any file(s) in the folder change
if: steps.changed-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "One or more files in the folder has changed."
echo "Files that have changed: $ALL_CHANGED_FILES"
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ ./PR_Check_Copy.sh $file == 'false' ]]; then
echo "result=false" >> "$GITHUB_OUTPUT"
break;
else
echo "result=true" >> "$GITHUB_OUTPUT"
fi
done
comment_pr:
needs: changed_files
runs-on: ubuntu-latest
steps:
- env:
resultjob1: ${{needs.changed_files.outputs.check_result}}
uses: actions/github-script@v7
with:
script: |
if (resultjob1 != false) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 All files are an exact match to previous environment(s)'
})
}