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
18 changes: 17 additions & 1 deletion .github/workflows/adj-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,20 @@ jobs:

- name: Run ADJ validation
run: |
python3 .github/workflows/scripts/adj-tester/main.py
python3 .github/workflows/scripts/adj-tester/main.py > /dev/null 2>&1

- name: Notify Slack on failure
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
jq -n \
--arg repo "${{ github.repository }}" \
--arg branch "${{ github.ref_name }}" \
--arg actor "${{ github.actor }}" \
--arg run_url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
'{
text: "<!channel> ❌ ADJ Validator Failed\n\nRepository: \($repo)\nBranch: \($branch)\nActor: \($actor)\n\nWorkflow run:\n\($run_url)"
}' | curl -X POST -H "Content-type: application/json" \
--data @- \
$SLACK_WEBHOOK
20 changes: 20 additions & 0 deletions .github/workflows/scripts/adj-tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,26 @@ def check_packet_json(
)
is_valid = False

# Ensure that if one of period_type, period, socket is present, all must be present
has_period_type = "period_type" in pkt
has_period = "period" in pkt
has_socket = "socket" in pkt

# Count how many of the three fields are present
fields_present = sum([has_period_type, has_period, has_socket])

# If any field is present, all three must be present
if fields_present > 0 and fields_present < 3:
error_list.append(
logError(
path,
f"id {pkt_id}",
f"Fields 'period_type', 'period', and 'socket' must all be present together or all be absent. "
f"Found: period_type={has_period_type}, period={has_period}, socket={has_socket}",
)
)
is_valid = False

except RuntimeError as e:
error_list.append(logError(path, "<load>", str(e)))
is_valid = False
Expand Down