From 3cb2c0f93b2a09cb8970a4b003cc531dfa990c1d Mon Sep 17 00:00:00 2001 From: Jess Bees Date: Mon, 7 Nov 2022 12:58:14 -0500 Subject: [PATCH 1/4] Before tarring site, set file read permissions Pages DFS needs the "group read" permission set on any file it serves, so add read permission before tarring to prevent unreadable files from being deployed. This only applies to files that are built on an actions runner, not files that are cloned from a git repoitory, because git's permissions are limited to the equivalents of chmod 644 and 755. --- action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/action.yml b/action.yml index b04808d..1369ae1 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,7 @@ runs: shell: sh if: runner.os == 'Linux' run: | + chmod -R +r . tar \ --dereference --hard-dereference \ --directory "$INPUT_PATH" \ @@ -32,6 +33,7 @@ runs: shell: sh if: runner.os == 'macOS' run: | + chmod -R +r . gtar \ --dereference --hard-dereference \ --directory "$INPUT_PATH" \ From 61a978d26175098df70f09238adf8869d5af93ad Mon Sep 17 00:00:00 2001 From: Jess Bees Date: Tue, 8 Nov 2022 10:33:02 -0500 Subject: [PATCH 2/4] Send a workflow warning when changing file permissions --- action.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 1369ae1..7c74026 100644 --- a/action.yml +++ b/action.yml @@ -17,7 +17,10 @@ runs: shell: sh if: runner.os == 'Linux' run: | - chmod -R +r . + for f in $(chmod -c -R +r . | awk '{print substr($3, 2, length($3)-2)}') + do + echo "::warning::Added read permission to $f" + done tar \ --dereference --hard-dereference \ --directory "$INPUT_PATH" \ @@ -33,7 +36,10 @@ runs: shell: sh if: runner.os == 'macOS' run: | - chmod -R +r . + for f in $(gchmod -c -R +r . | awk '{print substr($3, 2, length($3)-2)}') + do + echo "::warning::Added read permission to $f" + done gtar \ --dereference --hard-dereference \ --directory "$INPUT_PATH" \ From de1b81a30a1f953042d42dab2fc2dd5938867ba8 Mon Sep 17 00:00:00 2001 From: Jess Bees Date: Mon, 14 Nov 2022 11:41:47 -0500 Subject: [PATCH 3/4] Use macos's non-gnu version of chmod --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7c74026..083ef58 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ runs: shell: sh if: runner.os == 'macOS' run: | - for f in $(gchmod -c -R +r . | awk '{print substr($3, 2, length($3)-2)}') + for f in $(chmod -v -R +r) do echo "::warning::Added read permission to $f" done From 6de1c7ae49fa27f72e71ede5e410f7bff8071ebd Mon Sep 17 00:00:00 2001 From: Jess Bees Date: Tue, 15 Nov 2022 10:18:49 -0500 Subject: [PATCH 4/4] Fix the mac shell script --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 083ef58..9d1d147 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ runs: shell: sh if: runner.os == 'macOS' run: | - for f in $(chmod -v -R +r) + for f in $(chmod -v -R +r .) do echo "::warning::Added read permission to $f" done