Changed bash file name so lowercase #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [[ $(${PWD}/scripts/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)' | |
}) | |
} |