Skip to content

Commit

Permalink
refactor actions
Browse files Browse the repository at this point in the history
Signed-off-by: Samet Akcay <samet.akcay@intel.com>
  • Loading branch information
samet-akcay committed Nov 5, 2024
1 parent a294377 commit 157b08e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 62 deletions.
50 changes: 0 additions & 50 deletions .github/actions/linting/pre-commit.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/actions/linting/pre-commit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Pre-commit Checks'
description: 'Runs all pre-commit hooks'
inputs:
files:
description: 'Files to check'
required: false
default: '.'
runs:
using: 'composite'
steps:
- run: |
pip install pre-commit
pre-commit run --files ${{ inputs.files }}
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/linting/ruff/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Ruff Linter'
description: 'Runs Ruff linting'
inputs:
files:
description: 'Files to check'
required: false
default: '.'
runs:
using: 'composite'
steps:
- run: |
pip install ruff
ruff check ${{ inputs.files }}
shell: bash
14 changes: 14 additions & 0 deletions .github/actions/security/bandit/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 'Bandit Security Check'
description: 'Runs Bandit security checks through pre-commit'
inputs:
files:
description: 'Files to check'
required: false
default: '.'
runs:
using: 'composite'
steps:
- run: |
pip install pre-commit
pre-commit run bandit --files ${{ inputs.files }}
shell: bash
30 changes: 18 additions & 12 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@ on:

jobs:
pre-commit-full:
uses: ./.github/actions/linting/pre-commit.yaml@main # Add @main or specific reference
# Runs all hooks on all files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/linting/pre-commit
# Runs all hooks on all files

# Example of running specific hooks on changed files
ruff-changed:
uses: ./.github/actions/linting/specific-hooks.yaml@main # Add @main or specific reference
with:
hook_id: ruff
files: ${{ join(github.event.pull_request.changed_files, ' ') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/linting/ruff
with:
files: ${{ join(github.event.pull_request.changed_files, ' ') }}

# Security specific hooks
security-checks:
uses: ./.github/actions/linting/pre-commit.yaml@main # Add @main or specific reference
with:
hooks: bandit
bandit-security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/security/bandit
with:
files: '.' # Optional: can add files parameter if you want to scope it

0 comments on commit 157b08e

Please sign in to comment.