-
Notifications
You must be signed in to change notification settings - Fork 10
Add jsonnet-format check and fix workflows #273
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
Merged
greenc-FNAL
merged 14 commits into
Framework-R-D:main
from
greenc-FNAL:maintenance/jsonnet-format-workflows
Feb 2, 2026
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
96fef96
Add jsonnet-format check and fix workflows
google-labs-jules[bot] 3e23227
Fix Jsonnet formatting workflows
google-labs-jules[bot] 55379f6
Address review comments and improve Jsonnet workflows
google-labs-jules[bot] fcab892
Fix Jsonnet workflows, address review comments, and ensure full actio…
google-labs-jules[bot] ec933c6
Add `*.libsonnet` per @beojan
greenc-FNAL 21a072a
Resolve `actionlint` complaints
greenc-FNAL 57c9f1d
Fix functional issues
greenc-FNAL 30d0bb8
Standardize reusable workflows for cross-project support
google-labs-jules[bot] 8090442
Fix format for Jsonnet files
greenc-FNAL be0a244
standardize jsonnet workflows and fix change detection bug
google-labs-jules[bot] 609167e
standardize jsonnet workflows and fix change detection bug
google-labs-jules[bot] f517494
Merge remote-tracking branch 'upstream/main' into maintenance/jsonnet…
greenc-FNAL 01ecf94
Reconcile `REUSABLE_WORKFLOWS.md` with upstream
google-labs-jules[bot] c881e83
Apply markdownlint fixes
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| name: Jsonnet Format Check | ||
| run-name: "${{ github.actor }} checking jsonnet format" | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: "The branch, ref, or SHA to checkout. Defaults to the repository's default branch." | ||
| required: false | ||
| type: string | ||
| workflow_call: | ||
| inputs: | ||
| checkout-path: | ||
| description: "Path to check out code to" | ||
| required: false | ||
| type: string | ||
| skip-relevance-check: | ||
| description: "Bypass relevance check" | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| ref: | ||
| description: "The branch, ref, or SHA to checkout" | ||
| required: false | ||
| type: string | ||
| repo: | ||
| description: "The repository to checkout from" | ||
| required: false | ||
| type: string | ||
| pr-base-sha: | ||
| description: "Base SHA of the PR for relevance check" | ||
| required: false | ||
| type: string | ||
| pr-head-sha: | ||
| description: "Head SHA of the PR for relevance check" | ||
| required: false | ||
| type: string | ||
|
|
||
| env: | ||
| local_checkout_path: ${{ (github.event_name == 'workflow_call' && inputs.checkout-path) || format('{0}-src', github.event.repository.name) }} | ||
|
|
||
| jobs: | ||
| pre-check: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| is_act: ${{ steps.detect_act.outputs.is_act }} | ||
| ref: ${{ (github.event_name == 'workflow_call' && inputs.ref) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.ref || github.ref)) || github.sha }} | ||
| repo: ${{ (github.event_name == 'workflow_call' && inputs.repo) || github.repository }} | ||
| steps: | ||
| - name: Detect act environment | ||
| id: detect_act | ||
| uses: Framework-R-D/phlex/.github/actions/detect-act-env@main | ||
|
|
||
| detect-changes: | ||
| needs: pre-check | ||
| if: > | ||
| needs.pre-check.outputs.is_act != 'true' && | ||
| ( | ||
| github.event_name == 'pull_request' || | ||
| github.event_name == 'push' || | ||
| ( | ||
| github.event_name == 'workflow_call' && | ||
| inputs.skip-relevance-check != 'true' && | ||
| github.event.inputs == null && | ||
| github.event.comment == null | ||
| ) | ||
| ) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: read | ||
| outputs: | ||
| has_changes: ${{ steps.filter.outputs.matched }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| path: ${{ env.local_checkout_path }} | ||
| ref: ${{ needs.pre-check.outputs.ref }} | ||
| repository: ${{ needs.pre-check.outputs.repo }} | ||
|
|
||
| - name: Detect Jsonnet formatting changes | ||
| id: filter | ||
| uses: Framework-R-D/phlex/.github/actions/detect-relevant-changes@main | ||
| with: | ||
| repo-path: ${{ env.local_checkout_path }} | ||
| base-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-base-sha) || github.event.pull_request.base.sha || github.event.before }} | ||
| head-ref: ${{ (github.event_name == 'workflow_call' && inputs.pr-head-sha) || github.event.pull_request.head.sha || github.sha }} | ||
| file-type: jsonnet | ||
|
|
||
| - name: Report detection outcome | ||
| run: | | ||
| if [ "${{ steps.filter.outputs.matched }}" != "true" ]; then | ||
| echo "::notice::No Jsonnet-related changes detected; formatting check will be skipped." | ||
| else | ||
| echo "::group::Jsonnet-related files" | ||
| printf '%s\n' "${{ steps.filter.outputs.matched_files }}" | ||
| echo "::endgroup::" | ||
| fi | ||
|
|
||
| jsonnet-format-check: | ||
| needs: [pre-check, detect-changes] | ||
| if: > | ||
| needs.detect-changes.result == 'skipped' || | ||
| ( | ||
| needs.detect-changes.result == 'success' && | ||
| needs.detect-changes.outputs.has_changes == 'true' | ||
| ) | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: public.ecr.aws/bitnami/jsonnet:latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| ref: ${{ needs.pre-check.outputs.ref }} | ||
| repository: ${{ needs.pre-check.outputs.repo }} | ||
| path: ${{ env.local_checkout_path }} | ||
|
|
||
| - name: Check Jsonnet formatting | ||
| id: lint | ||
| working-directory: ${{ env.local_checkout_path }} | ||
| run: | | ||
| find . \( -name "*.jsonnet" -o -name "*.libsonnet" \) -print0 | xargs -0 -r -I {} \ | ||
| bash -c 'jsonnetfmt --test "{}" || (echo "FAILED: {}" && diff -u <(jsonnetfmt "{}") "{}" && exit 1)' | ||
| continue-on-error: true | ||
|
|
||
| - name: Evaluate Jsonnet formatting result | ||
| if: always() | ||
| run: | | ||
| if [ "${{ steps.lint.outcome }}" = 'success' ]; then | ||
| echo "✅ Jsonnet formatting check passed." | ||
| else | ||
| echo "::error::Jsonnet formatting issues found. Please review the output above for details." | ||
| echo "::error::Run 'jsonnetfmt -i <file>' locally or comment '@${{ github.event.repository.name }}bot format' on the PR to auto-fix." | ||
| exit 1 | ||
| fi | ||
|
|
||
| jsonnet-format-check-skipped: | ||
| needs: [pre-check, detect-changes] | ||
| if: > | ||
| needs.pre-check.outputs.is_act != 'true' && | ||
| ( | ||
| github.event_name == 'pull_request' || | ||
| github.event_name == 'push' || | ||
| ( | ||
| github.event_name == 'workflow_call' && | ||
| inputs.skip-relevance-check != 'true' && | ||
| github.event.inputs == null && | ||
| github.event.comment == null | ||
| ) | ||
| ) && | ||
| (needs.detect-changes.result == 'success' && needs.detect-changes.outputs.has_changes != 'true') | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: No relevant Jsonnet changes detected | ||
| run: echo "::notice::No Jsonnet-related changes detected; jsonnet-format check skipped." | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.