Skip to content

V1.0.0 alpha.4

V1.0.0 alpha.4 #19

name: Check for unsafeFlags
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
dump-package-check:
name: Dump Swift package (authoritative) and scan JSON
runs-on: ubuntu-latest
container:
image: swift:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install jq
run: |
apt-get update && apt-get install -y jq
- name: Dump package JSON and check for unsafeFlags
shell: bash
run: |
set -euo pipefail
# Compute unsafeFlags array directly from the dump (don't store the full dump variable)
unsafe_flags=$(swift package dump-package | jq -c '[.. | objects | .unsafeFlags? // empty]')
# Check array length to decide failure
if [ "$(echo "$unsafe_flags" | jq 'length')" -gt 0 ]; then
echo "ERROR: unsafeFlags found in resolved package JSON:"
echo "$unsafe_flags" | jq '.' || true
echo "--- resolved package dump (first 200 lines) ---"
# Print a sample of the authoritative dump (re-run dump-package for the sample)
swift package dump-package | sed -n '1,200p' || true
exit 1
else
echo "No unsafeFlags in resolved package JSON."
fi