Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 63 additions & 18 deletions .github/workflows/spdx-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,89 @@ name: SPDX + Copyright header check

on:
pull_request:
workflow_dispatch:

jobs:
spdx:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read

steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check header in changed .cs files
shell: bash
run: |
set -e
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
set -euo pipefail

if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE="${{ github.event.pull_request.base.sha }}"
HEAD="${{ github.event.pull_request.head.sha }}"
else
HEAD="${{ github.sha }}"
BASE="$(git rev-parse "${HEAD}^" 2>/dev/null || true)"
fi

FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true)
echo "Base SHA: ${BASE:-<none>}"
echo "Head SHA: $HEAD"
echo

if [ -z "$FILES" ]; then
if [ -z "${BASE:-}" ]; then
mapfile -t files < <(git ls-files '*.cs')
else
mapfile -t files < <(git diff --diff-filter=ACMR --name-only "$BASE" "$HEAD" -- '*.cs' || true)
fi

if [ "${#files[@]}" -eq 0 ]; then
echo "No C# files changed."
exit 0
fi

MISSING=""
for f in $FILES; do
HEADBLOCK=$(head -n 6 "$f")
echo "Changed C# files:"
printf ' - %s\n' "${files[@]}"
echo

missing=()

for f in "${files[@]}"; do
if [ ! -f "$f" ]; then
echo "Skipping missing file: $f"
continue
fi

headblock="$(head -n 20 "$f" | sed '1s/^\xEF\xBB\xBF//' | tr -d '\r')"

echo "Checking: $f"

if ! grep -q "SPDX-License-Identifier: LGPL-3.0-or-later" <<< "$headblock"; then
echo " Missing SPDX line"
missing+=("$f")
continue
fi

if ! grep -qE "Copyright \(c\) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" <<< "$headblock"; then
echo " Missing copyright line"
missing+=("$f")
continue
fi

echo "$HEADBLOCK" | grep -q "// SPDX-License-Identifier: LGPL-3.0-or-later" || MISSING="$MISSING $f"
echo "$HEADBLOCK" | grep -q "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f"
echo " OK"
done

if [ -n "$MISSING" ]; then
echo "❌ Missing required header in:"
for f in $MISSING; do echo " - $f"; done
echo ""
echo "Each changed .cs file must start with:"
echo
if [ "${#missing[@]}" -gt 0 ]; then
echo "Missing required header in:"
printf ' - %s\n' "${missing[@]}"
echo
echo "Each checked .cs file must contain within the first 20 lines:"
echo "// SPDX-License-Identifier: LGPL-3.0-or-later"
echo "// Copyright (c) 20202026 Michal Dengusiak & Jakub Ziolkowski and contributors"
echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors"
exit 1
fi

echo "SPDX + copyright headers OK."
echo "SPDX + copyright headers OK."
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Autodesk.Revit.Attributes;
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors

using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using SAM.Analytical.Revit.UI.Properties;
Expand Down Expand Up @@ -224,7 +227,7 @@ public override Result Execute(ExternalCommandData commandData, ref string messa
SimulateTo = 1
};

analyticalModel = Tas.Modify.RunWorkflow(analyticalModel, workflowSettings);
analyticalModel = Analytical.UI.WPF.Modify.RunWorkflow(analyticalModel, workflowSettings);

List<Core.ISAMObject> results = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<Reference Include="SAM.Analytical.UI">
<HintPath>..\..\..\SAM_UI\build\SAM.Analytical.UI.dll</HintPath>
</Reference>
<Reference Include="SAM.Analytical.UI.WPF">
<HintPath>..\..\..\SAM_UI\build\SAM.Analytical.UI.WPF.dll</HintPath>
</Reference>
<Reference Include="SAM.Analytical.Windows">
<HintPath>..\..\..\SAM_Windows\build\SAM.Analytical.Windows.dll</HintPath>
</Reference>
Expand Down
Binary file modified references_buildonly/Interop.TAS3D.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TBD.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TCD.dll
Binary file not shown.
Binary file added references_buildonly/Interop.TCR.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TIC.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TPD.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TSD.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TWD.dll
Binary file not shown.
Binary file modified references_buildonly/Interop.TasConv.dll
Binary file not shown.