Skip to content

Reset to defaults, test PR #34

Reset to defaults, test PR

Reset to defaults, test PR #34

Workflow file for this run

name: Diff after_create method
on:
pull_request:
branches:
- main
paths:
- 'backend/model/**'
push:
jobs:
diff:
runs-on: ubuntu-latest
env:
PROD_ARCHIVESSPACE_VERSION: v3.3.1
continue-on-error: true
strategy:
matrix:
archivesspace_version: [v3.3.1, v3.4.1, v3.5.1]
steps:
- name: Checkout current plugin
uses: actions/checkout@v4
with:
path: plugin
sparse-checkout: |
backend/model
- name: Checkout ArchivesSpace baseline repo
uses: actions/checkout@v4
with:
ref: ${{ env.PROD_ARCHIVESSPACE_VERSION }}
repository: Smithsonian/archivesspace
path: archivesspace-baseline
sparse-checkout: |
backend/app/model
- name: Checkout ArchivesSpace repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.archivesspace_version }}
repository: Smithsonian/archivesspace
path: archivesspace
sparse-checkout: |
backend/app/model
- name: Create plugin file
id: plugin
run: |
touch plugin.txt
grep -wsh after_create ${{ github.workspace }}/plugin/backend/model/* -A 81 > plugin.txt
echo "$(cat plugin.txt)"
- name: Create prod version file
id: prod
run: |
touch prod.txt
grep -wsh after_create ${{ github.workspace }}/archivesspace-baseline/backend/app/model/repository.rb -A 81 > prod.txt
echo "$(cat prod.txt)"
- name: Create ${{ matrix.archivesspace_version }} version file
run: |
grep -wsh after_create ${{ github.workspace }}/archivesspace/backend/app/model/structured_date_range.rb -A 1
- name: Diff with baseline
id: baseline
run: |
echo " ${{ steps.plugin.outputs.plugin_file }}"
echo "baseline_changes=$(diff prod.txt plugin.txt)" > $GITHUB_OUTPUT
- name: Diff with new versions
id: new
run: |
echo "new_changes=$(git diff --diff-filter=M --shortstat ${{ github.workspace }}/${{ matrix.archivesspace_version }}_method.rb ${{ steps.plugin.outputs.plugin_file }})" > $GITHUB_OUTPUT
- name: Diffs match
if: ${{ steps.baseline.outputs.baseline_changes == steps.new.outputs.new_changes }}
run: |
echo "${{ steps.baseline.outputs.baseline_changes }}"
echo "${{ steps.new.outputs.new_changes }}"
echo "${{ steps.new.outputs.new_changes2 }}"
echo "All models overridden by this plugin match $PROD_ARCHIVESSPACE_VERSION of ArchivesSpace"
- name: Diffs do not match
if: ${{ steps.baseline.outputs.baseline_changes != steps.new.outputs.new_changes }}
run: |
echo "Some models overridden by this plugin do not match those in ArchivesSpace ${{ matrix.archivesspace_version }}. See:"
echo "::set-output name=review_changes::$(git diff --diff-filter=M -w --color -- ${{ github.workspace }}/archivesspace/backend/app/model ${{ github.workspace }}/plugin/backend/model)"
exit 1