Added some formatting to the echo scripts GA #23
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: Check diff between template and current state | |
on: [push] | |
jobs: | |
generate-diff: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: | |
- 18.x | |
steps: | |
- name: Checkout source branch | |
uses: actions/checkout@v4 | |
with: | |
repository: Informatievlaanderen/OSLOthema-template | |
ref: standaardenregister | |
path: source | |
- name: Clone other repository | |
uses: actions/checkout@v4 | |
with: | |
# Dynamic reference to the active repository so that it works immediately when creating a new thema repo | |
# repository: ${{ github.repository }} | |
repository: Informatievlaanderen/OSLOthema-voorwaarden-dienstverlening | |
ref: standaardenregister | |
path: | |
target | |
# Extra step to debug the file structure | |
- name: List file structure of source dir | |
shell: bash | |
run: | | |
ls source | |
- name: List file structure of target dir | |
shell: bash | |
run: | | |
ls target | |
- name: Create diff | |
shell: bash | |
run: | | |
identical_files="" | |
different_files="" | |
for file in $(find source -type f | grep -v ".git"); do | |
target_file=${file/source/target} | |
if [ -f "$target_file" ]; then | |
diff_output=$(diff -q "$file" "$target_file" || true) | |
if [[ $diff_output == *"differ"* ]]; then | |
different_files+="$file\n" | |
else | |
identical_files+="$file\n" | |
fi | |
fi | |
done | |
echo "Identical files:" | |
echo "$identical_files" | |
echo "---------------------------------------------------" | |
echo "Different files:" | |
echo "$different_files" | |
# - name: Commit and push diff | |
# run: | | |
# cd source | |
# git config user.name github-actions | |
# git config user.email [email protected] | |
# git add diff.txt | |
# git commit -m "Add diff" | |
# git push |