Skip to content

feat(actions): export reusable github actions checker #13

feat(actions): export reusable github actions checker

feat(actions): export reusable github actions checker #13

Workflow file for this run

name: PR Checks
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
workflow_call:
inputs:
run-prettier:
description: "Run Prettier check"
required: false
type: boolean
default: true
run-markdown:
description: "Run Markdown check"
required: false
type: boolean
default: true
run-commits:
description: "Run Commit check"
required: false
type: boolean
default: true
package_json_file:
description: "Path to package.json file"
required: false
type: string
default: "package.json"
jobs:
check-draft:
runs-on: ubuntu-latest
outputs:
should-run: ${{ steps.check.outputs.should-run }}
steps:
- id: check
run: |
if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.draft }}" != "true" ]; then
echo "should-run=true" >> $GITHUB_OUTPUT
else
echo "should-run=false" >> $GITHUB_OUTPUT
fi
prettier:
needs: check-draft
if:
needs.check-draft.outputs.should-run == 'true' && (inputs.run-prettier !=
false || github.event_name != 'workflow_call')
uses: ./.github/workflows/prettier.yml
with:
package_json_file: ${{ inputs.package_json_file }}
markdown:
needs: check-draft
if:
needs.check-draft.outputs.should-run == 'true' && (inputs.run-markdown !=
false || github.event_name != 'workflow_call')
uses: ./.github/workflows/markdown-check.yml
commits:
needs: check-draft
if:
needs.check-draft.outputs.should-run == 'true' && (inputs.run-commits !=
false || github.event_name != 'workflow_call')
uses: ./.github/workflows/commit-check.yml
with:
package_json_file: ${{ inputs.package_json_file }}