Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fic(ci): Allow ci step to succeed if only markdown changed #1664

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
65 changes: 51 additions & 14 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,58 @@ on:
- opened
- synchronize
- reopened
paths-ignore:
- '**/*.md'
- LICENSE
- CODEOWNERS
push:
branches:
- main
paths-ignore:
- '**/*.md'
- LICENSE
- CODEOWNERS
merge_group:
branches:
- main
types:
- checks_requested
paths:
- '**'
- '!**/*.md'
- 'docs/**'
- '!LICENSE'
- '!CODEOWNERS'
workflow_call:

jobs:
deltas:
runs-on: ubuntu-latest
outputs:
paths_changed: ${{ steps.check_paths.outputs.paths_changed }} # Output value to other jobs
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
fetch-depth: 0

- name: Check if specific paths are changed
id: check_paths
# paths:
# - '**'
# - '!**/*.md'
# - '!LICENSE'
# - '!CODEOWNERS'
run: |
# Check if any non-Markdown files or 'docs/**' changed, and exclude 'LICENSE' and 'CODEOWNERS'

# Get the commit range for the diff (use HEAD^ for fallback)
before_commit="${{ github.event.before }}"
current_commit="${{ github.sha }}"

if [ -z "$before_commit" ]; then
before_commit="HEAD^"
fi

changed_files=$(git diff --name-only $before_commit $current_commit)
echo "Changed files: $changed_files"

if echo "$changed_files" | grep -Ev '\.md$' | grep -vE '^(LICENSE|CODEOWNERS)$'; then
echo "Paths of interest were modified."
echo "paths_changed=true" >> $GITHUB_OUTPUT
else
echo "No matching paths were modified."
echo "paths_changed=false" >> $GITHUB_OUTPUT
fi
go:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
runs-on: ubuntu-22.04
permissions:
checks: write
Expand Down Expand Up @@ -102,6 +128,8 @@ jobs:
if: env.IS_RELEASE_BRANCH == 'false'

integration:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
name: integration tests
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -161,6 +189,8 @@ jobs:
run: test/rego/custom-entity.bats

image:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
name: image build
runs-on: ubuntu-22.04
steps:
Expand All @@ -173,13 +203,17 @@ jobs:
push: false

platform-xtest:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
uses: opentdf/tests/.github/workflows/xtest.yml@main
with:
# use commit instead of ref so we can "go get" specific sdk version
platform-ref: ${{ github.event.pull_request.head.sha || github.sha }}

# test latest otdfctl CLI 'main' against platform PR branch
otdfctl-test:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
name: otdfctl e2e tests
runs-on: ubuntu-latest
steps:
Expand All @@ -191,6 +225,8 @@ jobs:
otdfctl-ref: 'main'

buflint:
needs: deltas
if: ${{ needs.deltas.outputs.paths_changed == 'true' }}
name: Protocol Buffer Lint and Gencode Up-to-date check
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -238,6 +274,7 @@ jobs:
- license
- platform-xtest
- otdfctl-test
- deltas
runs-on: ubuntu-22.04
if: ${{ !cancelled() }}
steps:
Expand Down
2 changes: 2 additions & 0 deletions service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ OpenTDF and ensures that all required services are configured and running as exp

## Quick Start

hello

> [!WARNING]
> This quickstart guide is intended for development and testing purposes only. The OpenTDF platform team does not
> provide recommendations for production deployments.
Expand Down
Loading