Skip to content

Commit

Permalink
still wip for lint
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudBeard committed Jun 28, 2024
1 parent fa05cd4 commit 315f271
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .github/actions/lint-oscal/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# action.yml
name: "lint-oscal"
description: "Lula Lint OSCAL"

runs:
using: "composite"
steps:
- name: lint-oscal
run: |
uds run lint-oscal --set OSCALFILES=${{ inputs.OSCALFILES }}
2 changes: 2 additions & 0 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ tempo:
- "src/tempo/**"
velero:
- "src/velero/**"
oscal:
- "**/*oscal*.yaml"
28 changes: 28 additions & 0 deletions .github/workflows/lint-oscal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint OSCAL Files

on:
push:
paths:
- '**/*oscal*.yaml'

permissions:
contents: read

Check failure on line 9 in .github/workflows/lint-oscal.yaml

View workflow job for this annotation

GitHub Actions / lint-check

9:5 [indentation] wrong indentation: expected 2 but found 4

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Identify changed OSCAL files
id: find_changed_files
run: |
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD | grep 'oscal.*\.yaml$' || true)
echo "Changed OSCAL files: $CHANGED_FILES"
echo "::set-output name=oscal_files::$CHANGED_FILES"
- name: Run lint-oscal
uses: .github/actions/lint-oscal/action.yaml
with:
OSCALFILES: ${{ steps.find_changed_files.outputs.oscal_files }}
24 changes: 21 additions & 3 deletions .github/workflows/pull-request-conditionals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ jobs:
run: brew install defenseunicorns/tap/[email protected]
- name: Run Formatting Checks
run: uds run lint-check --no-progress
- name: Setup Lula
uses: .github/actions/setup

# This job checks if there are changes in specific paths source packages.
check-paths:
Expand All @@ -61,7 +59,27 @@ jobs:
with:
filters: .github/filters.yaml

# This job triggers a separate workflow for each changed source package, if any.
run-lint-oscal:
needs: check-paths

Check failure on line 63 in .github/workflows/pull-request-conditionals.yaml

View workflow job for this annotation

GitHub Actions / lint-check

63:7 [indentation] wrong indentation: expected 4 but found 6
if: needs.check-paths.outputs.oscal_changed == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Identify changed OSCAL files
id: find_changed_files
run: |
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD | grep 'oscal.*\.yaml$' || true)
echo "Changed OSCAL files: $CHANGED_FILES"
echo "::set-output name=oscal_files::$CHANGED_FILES"
- name: Run lint-oscal
uses: ./.github/actions/lint-oscal/action.yaml
with:
OSCALFILES: ${{ steps.find_changed_files.outputs.oscal_files }}

# This job triggers a separate workflow for each changed source package, if any.
run-package-test:
needs: check-paths
name: Schedule
Expand Down

0 comments on commit 315f271

Please sign in to comment.