From 64126f93b1a3be08061df8816f72c723fb07c139 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 27 Dec 2021 14:45:57 -0800 Subject: [PATCH 1/5] Add --future support and + add a shellcheck --- .github/workflows/shellcheck.yml | 21 +++++++++++++++++++++ Gemfile | 2 +- action.yml.erb | 6 +++++- entrypoint.sh | 13 ++++++++++--- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..911dbd0 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -0,0 +1,21 @@ +name: 'ShellCheck' + +on: + pull_request: + paths: + - '**.sh' + +jobs: + shellcheck: + runs-on: ubuntu-latest + env: + SHELLCHECK_OPTS: -s bash + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@1.1.0 + with: + version: v0.8.0 + format: tty diff --git a/Gemfile b/Gemfile index 944d7b7..9365f9c 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # Manage our dependency on the version of the github-pages gem here. -gem "github-pages", "= 222" +gem "github-pages", "= 223" # Explicitly include this gem here. # It is not directly included in the github-pages gem list of dependencies, diff --git a/action.yml.erb b/action.yml.erb index 6ae7b8c..5ee6c7f 100644 --- a/action.yml.erb +++ b/action.yml.erb @@ -1,3 +1,4 @@ +# Generated from action.yml.erb # <%= nonce %> name: 'Pages Jekyll' description: 'A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages' @@ -10,6 +11,10 @@ inputs: description: 'Output directory of the build. Although it can be nested inside the source, it cannot be the same as the source directory.' required: false default: ./_site + future: + description: 'Publishes posts with a future date.' + required: false + default: true verbose: description: 'Verbose output' required: false @@ -21,4 +26,3 @@ inputs: runs: using: 'docker' image: '<%= pages_action_url %>' - diff --git a/entrypoint.sh b/entrypoint.sh index c78abac..9d25bc1 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,12 +18,19 @@ export JEKYLL_ENV="production" export JEKYLL_GITHUB_TOKEN=$INPUT_TOKEN export PAGES_REPO_NWO=$GITHUB_REPOSITORY -if [ -z $INPUT_VERBOSE ]; then +# Set verbose flag +if [ -z "$INPUT_VERBOSE" ]; then VERBOSE='' else VERBOSE='--verbose' fi -cd $PAGES_GEM_HOME +# Set future flag +if [ -z "$INPUT_FUTURE" ]; then + FUTURE='' +else + FUTURE='--future' +fi -$GITHUB_PAGES build $VERBOSE --source $SOURCE_DIRECTORY --destination $DESTINATION_DIRECTORY +cd "$PAGES_GEM_HOME" +$GITHUB_PAGES build $VERBOSE $FUTURE --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY" From b25c12117e2da53a0cd085b5e1ad4826f18165b9 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 27 Dec 2021 14:58:09 -0800 Subject: [PATCH 2/5] Pin shellcheck and switch to boolean inputs --- .github/workflows/shellcheck.yml | 2 +- action.yml.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index 911dbd0..164a26c 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v2 - name: Run ShellCheck - uses: ludeeus/action-shellcheck@1.1.0 + uses: ludeeus/action-shellcheck@94e0aab03ca135d11a35e5bfc14e6746dc56e7e9 with: version: v0.8.0 format: tty diff --git a/action.yml.erb b/action.yml.erb index 5ee6c7f..916be04 100644 --- a/action.yml.erb +++ b/action.yml.erb @@ -18,7 +18,7 @@ inputs: verbose: description: 'Verbose output' required: false - default: '1' + default: true token: description: 'GitHub token' required: true From 22f2e08e5f60a3fbac98f045d138d5414f651e5f Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 27 Dec 2021 15:00:36 -0800 Subject: [PATCH 3/5] Update action.yml --- action.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 422d451..8f54cbf 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,5 @@ -# 2f9877141f775a9030dcf59ab535e186 +# Generated from action.yml.erb +# 6fd2e419246dd9cc670908826ea4f649 name: 'Pages Jekyll' description: 'A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages' inputs: @@ -10,10 +11,14 @@ inputs: description: 'Output directory of the build. Although it can be nested inside the source, it cannot be the same as the source directory.' required: false default: ./_site + future: + description: 'Publishes posts with a future date.' + required: false + default: true verbose: description: 'Verbose output' required: false - default: '1' + default: true token: description: 'GitHub token' required: true @@ -21,4 +26,3 @@ inputs: runs: using: 'docker' image: 'docker://ghcr.io/actions/jekyll-build-pages:main' - From 4df4c80f3f50fa44cc80259b7983f44fa3b68768 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 27 Dec 2021 15:09:06 -0800 Subject: [PATCH 4/5] Allow for non-true values (verbose and future inputs) --- action.yml | 2 +- entrypoint.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 8f54cbf..179607e 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ # Generated from action.yml.erb -# 6fd2e419246dd9cc670908826ea4f649 +# cc3ed5559aaeabbc7ccc9899f91995ca name: 'Pages Jekyll' description: 'A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages' inputs: diff --git a/entrypoint.sh b/entrypoint.sh index 9d25bc1..462a8a9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,17 +19,17 @@ export JEKYLL_GITHUB_TOKEN=$INPUT_TOKEN export PAGES_REPO_NWO=$GITHUB_REPOSITORY # Set verbose flag -if [ -z "$INPUT_VERBOSE" ]; then - VERBOSE='' -else +if [ "$INPUT_VERBOSE" = 'true' ]; then VERBOSE='--verbose' +else + VERBOSE='' fi # Set future flag -if [ -z "$INPUT_FUTURE" ]; then - FUTURE='' -else +if [ "$INPUT_FUTURE" = 'true' ]; then FUTURE='--future' +else + FUTURE='' fi cd "$PAGES_GEM_HOME" From 006a9c284cc2650047731231678b4c28e60fadba Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Mon, 27 Dec 2021 15:27:23 -0800 Subject: [PATCH 5/5] Fix linter --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 462a8a9..2de362a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -33,4 +33,4 @@ else fi cd "$PAGES_GEM_HOME" -$GITHUB_PAGES build $VERBOSE $FUTURE --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY" +$GITHUB_PAGES build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY"