From 72e859ec46a33510f7105ad5b647acc63ec37e75 Mon Sep 17 00:00:00 2001 From: Sahil Walia Date: Thu, 23 Jul 2026 13:49:18 -0400 Subject: [PATCH 1/2] Infra: Add community workflows, compliance automation, and dependency review --- .github/PULL_REQUEST_TEMPLATE.md | 2 + .github/dependabot.yml | 29 ++++++ .github/labeler.yml | 96 +++++++++++++++++++ .github/workflows/asf-allowlist-check.yml | 36 +++++++ .github/workflows/auto-label-issues.yml | 40 ++++++++ .github/workflows/auto-label-prs.yml | 36 +++++++ .github/workflows/community-pr-helper.yml | 67 +++++++++++++ .github/workflows/dependency-review.yml | 35 +++++++ .github/workflows/license-check.yml | 35 +++++++ .github/workflows/pr-title-check.yml | 51 ++++++++++ .../workflows/remove-awaiting-response.yml | 68 +++++++++++++ .github/workflows/stale.yml | 81 ++++++++++++++++ .gitignore | 3 + dev/.rat-excludes | 62 ++++++++++++ dev/check-license | 52 ++++++++++ 15 files changed, 693 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/asf-allowlist-check.yml create mode 100644 .github/workflows/auto-label-issues.yml create mode 100644 .github/workflows/auto-label-prs.yml create mode 100644 .github/workflows/community-pr-helper.yml create mode 100644 .github/workflows/dependency-review.yml create mode 100644 .github/workflows/license-check.yml create mode 100644 .github/workflows/pr-title-check.yml create mode 100644 .github/workflows/remove-awaiting-response.yml create mode 100644 .github/workflows/stale.yml create mode 100644 dev/.rat-excludes create mode 100755 dev/check-license diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 45d0ca85..626e6235 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -39,6 +39,7 @@ ### Converters - [ ] Converter logic in `converters/` is updated to reflect spec or ontology changes - [ ] New converters include tests under the converter's test directory +- [ ] If adding a new converter, `.github/labeler.yml` is updated with the new path ### Validation - [ ] Validation rules in `validation/` are updated if the spec changed @@ -59,3 +60,4 @@ ### Compliance - [ ] ASF license headers are present on all new source files - [ ] No third-party dependencies are added without PMC/IPMC approval +- [ ] If third-party source code is vendored/copied (not just declared as a dependency), `NOTICE` and/or `LICENSE` have been updated per [ASF policy](https://infra.apache.org/licensing-howto.html) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f4b94185 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + groups: + actions-minor: + update-types: + - "minor" + - "patch" diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..25109bb3 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,96 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Catch-all: any converter change gets this label (including new converters) +converter: + - changed-files: + - any-glob-to-any-file: 'converters/**' + +# Specific converter labels +converter/dbt: + - changed-files: + - any-glob-to-any-file: 'converters/dbt/**' + +converter/databricks: + - changed-files: + - any-glob-to-any-file: 'converters/databricks/**' + +converter/gooddata: + - changed-files: + - any-glob-to-any-file: 'converters/gooddata/**' + +converter/honeydew: + - changed-files: + - any-glob-to-any-file: 'converters/honeydew/**' + +converter/omni: + - changed-files: + - any-glob-to-any-file: 'converters/omni/**' + +converter/orionbelt: + - changed-files: + - any-glob-to-any-file: 'converters/orionbelt/**' + +converter/polaris: + - changed-files: + - any-glob-to-any-file: 'converters/polaris/**' + +converter/salesforce: + - changed-files: + - any-glob-to-any-file: 'converters/salesforce/**' + +converter/snowflake: + - changed-files: + - any-glob-to-any-file: 'converters/snowflake/**' + +converter/wisdom: + - changed-files: + - any-glob-to-any-file: 'converters/wisdom/**' + +# Other areas +cli: + - changed-files: + - any-glob-to-any-file: 'cli/**' + +spec: + - changed-files: + - any-glob-to-any-file: 'core-spec/**' + +ontology: + - changed-files: + - any-glob-to-any-file: 'ontology/**' + +docs: + - changed-files: + - any-glob-to-any-file: 'docs/**' + +validation: + - changed-files: + - any-glob-to-any-file: 'validation/**' + +examples: + - changed-files: + - any-glob-to-any-file: 'examples/**' + +infra: + - changed-files: + - any-glob-to-any-file: + - '.github/**' + - '.asf.yaml' + - 'Makefile' + - '.pre-commit-config.yaml' + - 'ruff.toml' diff --git a/.github/workflows/asf-allowlist-check.yml b/.github/workflows/asf-allowlist-check.yml new file mode 100644 index 00000000..f8ced8bd --- /dev/null +++ b/.github/workflows/asf-allowlist-check.yml @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: ASF Allowlist Check + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + asf-allowlist-check: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: apache/infrastructure-actions/allowlist-check@main diff --git a/.github/workflows/auto-label-issues.yml b/.github/workflows/auto-label-issues.yml new file mode 100644 index 00000000..027f7064 --- /dev/null +++ b/.github/workflows/auto-label-issues.yml @@ -0,0 +1,40 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Auto Label New Issues + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + label: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels: ['needs-triage'] + }); diff --git a/.github/workflows/auto-label-prs.yml b/.github/workflows/auto-label-prs.yml new file mode 100644 index 00000000..fc46257a --- /dev/null +++ b/.github/workflows/auto-label-prs.yml @@ -0,0 +1,36 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Auto Label PRs + +on: + pull_request_target: + types: [opened, synchronize, reopened] + +permissions: + contents: read + pull-requests: write + +jobs: + label-by-files: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + sync-labels: true diff --git a/.github/workflows/community-pr-helper.yml b/.github/workflows/community-pr-helper.yml new file mode 100644 index 00000000..ffcff322 --- /dev/null +++ b/.github/workflows/community-pr-helper.yml @@ -0,0 +1,67 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Community PR Helper + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + +jobs: + welcome: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + // Only greet first-time contributors + const { data: prs } = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'all', + creator: context.payload.pull_request.user.login + }); + + if (prs.length > 1) { + console.log('Not a first-time contributor, skipping welcome.'); + return; + } + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: [ + 'Thank you for your first contribution to Apache Ossie (incubating)!', + '', + 'A committer will review your PR. In the meantime, please ensure:', + '', + '- All CI checks pass', + '- ASF license headers are present on new source files', + '- Tests cover new functionality', + '', + '**Before your contribution can be merged**, you need an [Individual Contributor License Agreement (ICLA)](https://www.apache.org/licenses/contributor-agreements.html) on file with the ASF.', + '', + '**Questions?** Ask in the PR comments or on our [Slack](https://join.slack.com/t/ossaboratories/shared_invite/zt-38v10kmo4-TZXFfGCPwPEM4SPhKrAHUw).', + '', + 'We appreciate your contribution!' + ].join('\n') + }); diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 00000000..47b54cbd --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Dependency Review + +on: [pull_request] + +permissions: + contents: read + pull-requests: write + +jobs: + dependency-review: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/dependency-review-action@v4 + with: + deny-licenses: GPL-2.0-only, GPL-2.0-or-later, GPL-3.0-only, GPL-3.0-or-later, LGPL-2.1-only, LGPL-2.1-or-later, LGPL-3.0-only, LGPL-3.0-or-later, AGPL-3.0-only, AGPL-3.0-or-later, SSPL-1.0, EUPL-1.1, EUPL-1.2 + comment-summary-in-pr: always diff --git a/.github/workflows/license-check.yml b/.github/workflows/license-check.yml new file mode 100644 index 00000000..f9764689 --- /dev/null +++ b/.github/workflows/license-check.yml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: License Header Check + +on: + pull_request: + +permissions: + contents: read + +jobs: + rat: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Run Apache RAT + run: dev/check-license diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 00000000..17ba8541 --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: PR Title Check + +on: + pull_request: + types: [opened, edited, reopened] + +permissions: + contents: read + +jobs: + check-pr-title: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + env: + PR_TITLE: ${{ github.event.pull_request.title }} + steps: + - name: Check PR title format + run: | + # Enforce "Area: Description" format + # Examples: "Converter/dbt: Add metric support", "CLI: Fix plugin listing", "Spec: Update entity schema" + PATTERN='^(Revert ")?[A-Za-z][A-Za-z0-9._+/&,-]*( [A-Za-z0-9][A-Za-z0-9._+/&,-]*)*: .+' + if ! echo "$PR_TITLE" | grep -Eq "$PATTERN"; then + echo "::error::PR title must follow 'Area: Description' format." + echo "" + echo "Examples:" + echo " Converter/dbt: Add metric support" + echo " CLI: Fix plugin listing" + echo " Spec: Update entity schema" + echo " Infra: Add community workflows" + echo " Docs: Update contributing guide" + echo "" + echo "Valid area prefixes include: Converter/, CLI, Spec, Ontology, Docs, Infra, Validation, Examples" + exit 1 + fi diff --git a/.github/workflows/remove-awaiting-response.yml b/.github/workflows/remove-awaiting-response.yml new file mode 100644 index 00000000..3b23a7c0 --- /dev/null +++ b/.github/workflows/remove-awaiting-response.yml @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Remove Awaiting Response Label + +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + pull_request: + types: [synchronize] + +permissions: + issues: write + pull-requests: write + +jobs: + remove-awaiting-response: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v7 + with: + script: | + const issue = context.issue || context.payload.pull_request; + const commenter = context.payload.comment?.user.login || context.payload.sender.login; + const issueAuthor = context.payload.issue?.user.login || context.payload.pull_request?.user.login; + + if (commenter === issueAuthor) { + const { data: labels } = await github.rest.issues.listLabelsOnIssue({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number + }); + + const hasLabel = labels.some(l => l.name === 'awaiting-response'); + + if (hasLabel) { + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + name: 'awaiting-response' + }).catch(() => {}); + + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue.number, + labels: ['needs-review'] + }); + } + } diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..59b2e827 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,81 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Close Stale Issues and PRs + +on: + schedule: + - cron: '0 0 * * 0' # Weekly on Sunday midnight UTC + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + if: github.repository_owner == 'apache' + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + days-before-issue-stale: 90 + days-before-issue-close: 14 + stale-issue-label: 'stale' + only-issue-labels: 'awaiting-response' + stale-issue-message: > + This issue has been automatically marked as stale because it has been + waiting for a response for 90 days. It will be closed in 14 days if + no further activity occurs. + + If this is still relevant, please provide the requested information or + comment to keep it open. You can also reach out on the dev@ossie.apache.org + mailing list. + close-issue-message: > + This issue has been automatically closed due to inactivity. + + If this is still relevant, please feel free to: + - Reopen this issue with the requested information + - Create a new issue with complete details + - Discuss on the dev@ossie.apache.org mailing list + + days-before-pr-stale: 60 + days-before-pr-close: 14 + stale-pr-label: 'stale' + only-pr-labels: 'awaiting-response' + stale-pr-message: > + This pull request has been marked as stale because the requested + changes or feedback have not been addressed for 60 days. It will be + closed in 14 days if no activity occurs. + + To keep this PR active, please address the review comments or respond + to questions from reviewers. + close-pr-message: > + This pull request has been automatically closed due to inactivity. + + If you would like to continue this work, please reopen the PR and + address the outstanding feedback. We appreciate your contribution! + + exempt-issue-labels: 'priority:critical,security,good-first-issue,in-progress,needs-review,needs-triage' + exempt-pr-labels: 'priority:critical,security,in-progress,needs-review' + exempt-all-issue-assignees: true + exempt-all-pr-assignees: true + exempt-all-issue-milestones: true + exempt-all-pr-milestones: true + operations-per-run: 100 diff --git a/.gitignore b/.gitignore index 3d183e14..895625cc 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ cli/dist/ cli/ossie cli/.tool-versions + +# Apache RAT (downloaded by dev/check-license) +dev/lib/ diff --git a/dev/.rat-excludes b/dev/.rat-excludes new file mode 100644 index 00000000..c0fb61fa --- /dev/null +++ b/dev/.rat-excludes @@ -0,0 +1,62 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Files excluded from Apache RAT license header checks. +# Keep this list minimal — only exclude files where a license header +# is impossible or inappropriate (binary, generated, third-party). + +# Binary and generated files +**/*.png +**/*.jpg +**/*.ico +**/*.woff +**/*.woff2 + +# Lock files and dependency manifests +**/*.lock +**/go.sum + +# Data/config files that cannot contain comments +**/*.json +**/*.csv + +# Snapshot/fixture test files +**/snapshots/** +**/__snapshots__/** + +# Git and IDE +.git/** +.idea/** +.vscode/** +**/.gitignore + +# Build output +**/build/** +**/dist/** +**/*.egg-info/** +**/__pycache__/** +**/node_modules/** +**/.venv/** +**/target/** + +# Files that are themselves license/notice +**/LICENSE +**/NOTICE + +# Specific project files +.editorconfig +.python-version diff --git a/dev/check-license b/dev/check-license new file mode 100755 index 00000000..0b63b872 --- /dev/null +++ b/dev/check-license @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Checks that all source files contain the ASF license header +# using Apache RAT (Release Audit Tool). + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +RAT_VERSION="0.16.1" +RAT_JAR="$SCRIPT_DIR/lib/apache-rat-${RAT_VERSION}.jar" +RAT_URL="https://repo1.maven.org/maven2/org/apache/rat/apache-rat/${RAT_VERSION}/apache-rat-${RAT_VERSION}.jar" + +# Download RAT if not cached +if [ ! -f "$RAT_JAR" ]; then + echo "Downloading Apache RAT ${RAT_VERSION}..." + mkdir -p "$SCRIPT_DIR/lib" + curl -sSfL -o "$RAT_JAR" "$RAT_URL" +fi + +# Ensure Java is available +if ! command -v java &> /dev/null; then + echo "ERROR: Java is required to run Apache RAT." + echo "Install Java 11+ and ensure it is on PATH." + exit 1 +fi + +echo "Running Apache RAT license header check..." +java -jar "$RAT_JAR" \ + --input-exclude-file "$SCRIPT_DIR/.rat-excludes" \ + --input-exclude-std GIT IDEA MAC \ + --output-style missing-headers \ + --log-level ERROR \ + -- "$REPO_DIR" + +echo "License header check passed." From 0bda805a6ae7be97f6b20bdb51226e01fae249af Mon Sep 17 00:00:00 2001 From: Sahil Walia Date: Thu, 23 Jul 2026 16:09:59 -0400 Subject: [PATCH 2/2] Removing allowlist check yaml --- .github/workflows/asf-allowlist-check.yml | 36 ----------------------- 1 file changed, 36 deletions(-) delete mode 100644 .github/workflows/asf-allowlist-check.yml diff --git a/.github/workflows/asf-allowlist-check.yml b/.github/workflows/asf-allowlist-check.yml deleted file mode 100644 index f8ced8bd..00000000 --- a/.github/workflows/asf-allowlist-check.yml +++ /dev/null @@ -1,36 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -name: ASF Allowlist Check - -on: - pull_request: - push: - branches: [main] - -permissions: - contents: read - -jobs: - asf-allowlist-check: - if: github.repository_owner == 'apache' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - persist-credentials: false - - uses: apache/infrastructure-actions/allowlist-check@main