make lint job reusable

develop
Myk Taylor 2023-08-03 00:25:20 -07:00
parent 794bcc67b0
commit 38d17cbdce
No known key found for this signature in database
2 changed files with 49 additions and 21 deletions

@ -100,27 +100,10 @@ jobs:
secrets: inherit secrets: inherit
lint: lint:
runs-on: ubuntu-latest uses: ./.github/workflows/lint.yml
steps:
- name: Install Lua
run: |
sudo apt-get update
sudo apt-get install lua5.3
- name: Clone DFHack
uses: actions/checkout@v3
with: with:
submodules: true dfhack_ref: ${{ github.ref }}
- name: Check whitespace secrets: inherit
run: python ci/lint.py --git-only --github-actions
- name: Check Authors.rst
if: always()
run: python ci/authors-rst.py
- name: Check for missing documentation
if: always()
run: python ci/script-docs.py
- name: Check Lua syntax
if: always()
run: python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions
check-pr: check-pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest

@ -0,0 +1,45 @@
name: Lint
on:
workflow_call:
inputs:
dfhack_ref:
type: string
required: true
scripts_ref:
type: string
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Lua
run: |
sudo apt-get update
sudo apt-get install lua5.3
- name: Clone DFHack
uses: actions/checkout@v3
with:
repository: 'DFHack/dfhack'
ref: ${{ inputs.dfhack_ref }}
- name: Get scripts submodule ref
if: '!inputs.scripts_ref'
id: scriptssubmoduleref
run: echo ref=$(git submodule | fgrep scripts | cut -c2-41) >> $GITHUB_OUTPUT
- name: Clone scripts
uses: actions/checkout@v3
with:
repository: 'DFHack/scripts'
ref: ${{ inputs.scripts_ref || steps.scriptssubmoduleref.outputs.ref }}
path: scripts
- name: Check whitespace
run: python ci/lint.py --git-only --github-actions
- name: Check Authors.rst
if: always()
run: python ci/authors-rst.py
- name: Check for missing documentation
if: always()
run: python ci/script-docs.py
- name: Check Lua syntax
if: always()
run: python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions