Reset to defaults, test PR #47
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: 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 | |
run: | | |
touch plugin.txt | |
grep -wsh after_create ${{ github.workspace }}/plugin/backend/model/* -A 81 > 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 | |
- name: Create ${{ matrix.archivesspace_version }} version file | |
run: | | |
touch ${{ matrix.archivesspace_version }}.txt | |
grep -wsh after_create ${{ github.workspace }}/archivesspace/backend/app/model/repository.rb -A 81 > ${{ matrix.archivesspace_version }}.txt | |
- name: Diff with baseline | |
id: baseline | |
run: | | |
echo "baseline_changes=$(git diff --diff-filter=M --shortstat ${{ github.workspace }}/prod.txt ${{ github.workspace }}/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 }}.txt ${{ github.workspace }}/plugin.txt)" >> $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 "$(git diff --diff-filter=M -w --color -- ${{ github.workspace }}/${{ matrix.archivesspace_version }}.txt ${{ github.workspace }}/plugin.txt)" | |
echo "All models overridden by this plugin match ${{ matrix.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 }}/${{ matrix.archivesspace_version }}.txt ${{ github.workspace }}/plugin.txt)" | |
exit 1 |