fix (migration) Move migrated apps and libs to a dedicated deprecated folder #82
Workflow file for this run
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: Block PRs on apps and libs migrated to cloudoperators | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
changes: | |
runs-on: [ubuntu-latest] | |
outputs: | |
apps: ${{ steps.filters.outputs.apps }} | |
libs: ${{ steps.filters.outputs.libs }} | |
app-changes: ${{ steps.app-filters.outputs.changes }} | |
lib-changes: ${{ steps.lib-filters.outputs.changes }} | |
steps: | |
- name: Checkout Pull Request | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Generate app and lib filters | |
run: | | |
for folder in apps/*; do | |
folder_name=$(basename "$folder") | |
echo "$folder_name: $folder/**" >> temp_app_filters.yaml | |
done | |
for folder in libs/*; do | |
folder_name=$(basename "$folder") | |
echo "$folder_name: $folder/**" >> temp_lib_filters.yaml | |
done | |
- uses: dorny/paths-filter@v3 | |
id: filters | |
with: | |
list-files: shell | |
filters: | | |
apps: apps/** | |
libs: libs/** | |
- uses: dorny/paths-filter@v3 | |
id: app-filters | |
with: | |
list-files: shell | |
filters: temp_app_filters.yaml | |
- uses: dorny/paths-filter@v3 | |
id: lib-filters | |
with: | |
list-files: shell | |
filters: temp_lib_filters.yaml | |
- name: Show outputs | |
run: | | |
echo "====================" | |
cat temp_app_filters.yaml | |
echo "====================" | |
cat temp_lib_filters.yaml | |
echo "====================" | |
echo apps: ${{ steps.filters.outputs.apps}} | |
echo apps_files: ${{ steps.filters.outputs.apps_files}} | |
echo app changes: ${{ steps.app-filters.outputs.changes}} | |
echo libs: ${{ steps.filters.outputs.libs}} | |
echo libs_files: ${{ steps.filters.outputs.libs_files}} | |
echo lib changes: ${{ steps.lib-filters.outputs.changes}} | |
echo "====================" | |
evaluate-changes: | |
needs: changes | |
runs-on: [ubuntu-latest] | |
env: | |
APPS: "supernova heureka greenhouse greenhouse-management exampleapp template" | |
LIBS: "communicator oauth policy-engine messages-provider juno-ui-components url-state-provider url-state-router utils" | |
steps: | |
- name: Show inputs | |
run: | | |
echo apps: ${{ needs.changes.outputs.apps }} | |
echo libs: ${{ needs.changes.outputs.libs }} | |
echo app changes: ${{ needs.changes.outputs.app-changes }} | |
echo lib changes: ${{ needs.changes.outputs.lib-changes }} | |
- name: Check if changes belong to restricted apps or libs | |
id: check-changes | |
run: | | |
check_changes() { | |
local changes=$1 | |
local list=$2 | |
local type=$3 | |
for item in $list; do | |
if [[ $changes == *"$item"* ]]; then | |
echo "Not allowed to make changes to specified $type: $item" | |
exit 1 | |
fi | |
done | |
echo "No restricted changes found in $type" | |
return 0 | |
} | |
app_changes="${{ needs.changes.outputs.app-changes }}" | |
lib_changes="${{ needs.changes.outputs.lib-changes }}" | |
check_changes "$app_changes" "$APPS" "app" | |
check_changes "$lib_changes" "$LIBS" "lib" | |
echo "Changes are allowed." |