From be398d962f7435084a9d93aab0fb145af34a5265 Mon Sep 17 00:00:00 2001 From: Lora Woodford Date: Fri, 27 Dec 2024 11:50:12 -0500 Subject: [PATCH] Reset to defaults, test PR Add new permission to viewers Run workflow on push as well Make another permission change Change base version, revert to defaults Use file instead workflow changes specify file change group again make it fail fail for real break correct file output file file output file export to file correct filepath trying again not to file remove file filename file changes path to working prod updated basic diff files one line cat file same for prod plugin file file creation syntax change diff all pushes cat outside closer file path remove output default aspace groups output new permission echo changes matrix versions diff report should pass show diff even when matching logging success remove extra permission --- .github/workflows/diff.yml | 29 +++++++++++++++++++++++------ backend/model/repository.rb | 2 +- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/diff.yml b/.github/workflows/diff.yml index 9da9d30..4926d69 100644 --- a/.github/workflows/diff.yml +++ b/.github/workflows/diff.yml @@ -6,6 +6,7 @@ on: - main paths: - 'backend/model/**' + push: jobs: diff: @@ -43,27 +44,43 @@ jobs: 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 }}/archivesspace-baseline/backend/app/model ${{ github.workspace }}/plugin/backend/model)" > $GITHUB_OUTPUT - + 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 }}/archivesspace/backend/app/model ${{ github.workspace }}/plugin/backend/model)" > $GITHUB_OUTPUT + 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 "${{ steps.new.outputs.new_changes2 }}" - echo "All models overridden by this plugin match $PROD_ARCHIVESSPACE_VERSION of ArchivesSpace" + 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 }}/archivesspace/backend/app/model ${{ github.workspace }}/plugin/backend/model)" + 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 diff --git a/backend/model/repository.rb b/backend/model/repository.rb index 7d2e298..a24f339 100644 --- a/backend/model/repository.rb +++ b/backend/model/repository.rb @@ -70,7 +70,7 @@ def after_create { :group_code => "repository-viewers", :description => I18n.t("group.default_group_names.repository_viewers", :repo_code => repo_code), - :grants_permissions => ["view_repository", "create_job"] + :grants_permissions => ["view_repository"] }] RequestContext.open(:repo_id => self.id) do