Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 19 additions & 40 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
name: CI
name: Lint

on:
pull_request:
branches: [main]
workflow_call:
inputs:
runner:
required: false
default: "['ubuntu-latest']"
type: string

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check release notes on pull_request
if: github.event_name == 'pull_request'
uses: open-turo/actions-release/lint-release-notes@v4
secrets:
github-token:
required: true

test:
name: Test
runs-on: ubuntu-latest
jobs:
pre-commit:
runs-on: ${{ fromJson(inputs.runner) }}
steps:
- uses: open-turo/actions-gha/test@v2
- uses: open-turo/actions-python/pre-commit@feat/run-actions-in-parallel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.github-token }}

# lint-oss tries to run this action against open source repositories not in
# open-turo to make sure this is usable outside the org.
# Repositories added to this list should have pre-commit hooks that don't
# require external tooling to be installed.
# Repositories added to this list must have passing pre-commit hooks.
lint-oss:
name: Lint / Open source
runs-on: ubuntu-latest
strategy:
matrix:
repos:
- tiangolo/fastapi
commitlint:
runs-on: ${{ fromJson(inputs.runner) }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ matrix.repos }}
- uses: actions/checkout@v4
with:
path: actions-python
- uses: ./actions-python/lint
- uses: open-turo/actions-python/pre-commit@feat/run-actions-in-parallel
with:
checkout-repo: false
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.github-token }}
49 changes: 49 additions & 0 deletions .github/workflows/repo-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
pull_request:
branches: [main]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check release notes on pull_request
if: github.event_name == 'pull_request'
uses: open-turo/actions-release/lint-release-notes@v4

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/test@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# lint-oss tries to run this action against open source repositories not in
# open-turo to make sure this is usable outside the org.
# Repositories added to this list should have pre-commit hooks that don't
# require external tooling to be installed.
# Repositories added to this list must have passing pre-commit hooks.
lint-oss:
name: Lint / Open source
runs-on: ubuntu-latest
strategy:
matrix:
repos:
- tiangolo/fastapi
steps:
- uses: actions/checkout@v4
with:
repository: ${{ matrix.repos }}
- uses: actions/checkout@v4
with:
path: actions-python
- uses: ./actions-python/lint
with:
checkout-repo: false
github-token: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.
27 changes: 27 additions & 0 deletions commitlint/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Commitlint Action"
description: "Lint commit messages using commitlint"
inputs:
node-version:
description: "Node version"
required: false
default: "16"
runs:
using: "composite"
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
- name: Install commitlint
run: npm install --save-dev @commitlint/cli @commitlint/config-conventional @open-turo/commitlint-config-conventional
shell: bash
- name: Run commitlint for pull requests
if: ${{ github.event_name == 'pull_request' }}
run: |
npx commitlint --from origin/${{ github.base_ref }} --to HEAD --verbose
shell: bash
- name: Run commitlint for push to main
if: ${{ github.event_name == 'push' }}
run: |
npx commitlint --from ${{ github.event.before }} --to ${{ github.event.after }} --verbose
shell: bash
31 changes: 31 additions & 0 deletions pre-commit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Pre-commit Action"
description: "Run pre-commit in your GitHub Actions workflow"
inputs:
python-version:
description: "Python version"
required: false
default: "3.11"
extra_args:
description: "Extra arguments to pass to pre-commit"
required: false
default: ""

runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install pre-commit
run: pip install pre-commit
shell: bash
# #cache pre-commit cache
# - name: Cache pre-commit cache
# uses: actions/cache@v4
# with:
# path: ~/.cache/pre-commit
# key: pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash