Skip to content

Commit

Permalink
Reset to defaults, test PR
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lorawoodford committed Dec 27, 2024
1 parent 14a01fd commit be398d9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- main
paths:
- 'backend/model/**'
push:

jobs:
diff:
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion backend/model/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit be398d9

Please sign in to comment.