Skip to content

reset yaml files for test run #34

reset yaml files for test run

reset yaml files for test run #34

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 }}
any_changed: ${{ steps.changed-files.outputs.any_changed }}
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
id: step1
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"
echo "result=true" >> "$GITHUB_OUTPUT"
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $(${PWD}/scripts/pr_check_copy.sh $file) == 'false' ]]; then
echo "result=false" >> "$GITHUB_OUTPUT"
break;
fi
done
comment_pr:
needs: changed_files
if: contains(needs.changed_files.outputs.any_changed, 'true')
runs-on: ubuntu-latest
steps:
- env:
CHECK_RESULT: ${{ needs.changed_files.outputs.check_result }}
uses: actions/github-script@v7
with:
script: |
if ($CHECK_RESULT != '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)'
})
}