Skip to content

ci: update ShieldCI security scan workflow#7

Open
Zenith1415 wants to merge 6 commits intoAkshat-Raj:mainfrom
Zenith1415:main
Open

ci: update ShieldCI security scan workflow#7
Zenith1415 wants to merge 6 commits intoAkshat-Raj:mainfrom
Zenith1415:main

Conversation

@Zenith1415
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 7, 2026 00:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ShieldCI GitHub Actions workflow to support additional trigger modes and simplify some step logic for running the self-hosted ShieldCI engine and reporting results.

Changes:

  • Add push and workflow_dispatch triggers alongside pull_request.
  • Simplify engine checks/copy steps and inline duration calculation output.
  • Minor refactors to result-push invocation and PR-comment script formatting.
Comments suppressed due to low confidence (1)

.github/workflows/shieldci.yml:70

  • This step is gated with if: always() but the workflow now runs on push/workflow_dispatch too. On those events context.issue.number is undefined, so issues.createComment will throw and can fail the workflow. Gate this step to PR events (or add a guard in the script to no-op when there is no PR issue number).
      - name: Post scan summary as PR comment
        if: always()
        uses: actions/github-script@v7

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 3 to +8
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow now runs on push and workflow_dispatch, but later steps assume a PR context (e.g., github.head_ref, github.event.pull_request.*, and posting a PR comment). On non-PR runs this will produce empty/incorrect metadata and the PR comment step will fail because there’s no context.issue.number. Update the metadata collection and add event-specific conditionals (e.g., only comment on PRs; use github.ref_name/github.sha for push/dispatch).

Copilot uses AI. Check for mistakes.
Comment on lines +65 to +66
SHIELDCI_RESULTS_FILE: $HOME/Desktop/ShieldCI/tests/shield_results.json
run: python3 "$HOME/Desktop/ShieldCI/push_results.py"
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIELDCI_RESULTS_FILE: $HOME/... in an env: block won’t be shell-expanded, so the Python script will receive the literal string $HOME/Desktop/... (likely causing file-not-found). Set this using a GitHub expression (if available) or compute/export it within the run: shell using $HOME so it expands correctly.

Suggested change
SHIELDCI_RESULTS_FILE: $HOME/Desktop/ShieldCI/tests/shield_results.json
run: python3 "$HOME/Desktop/ShieldCI/push_results.py"
run: |
export SHIELDCI_RESULTS_FILE="$HOME/Desktop/ShieldCI/tests/shield_results.json"
python3 "$HOME/Desktop/ShieldCI/push_results.py"

Copilot uses AI. Check for mistakes.
@@ -65,29 +62,24 @@
SHIELDCI_COMMIT_MSG: ${{ steps.meta.outputs.commit_msg }}
SHIELDCI_DURATION: ${{ steps.scan.outputs.duration }}
SHIELDCI_TRIGGERED_BY: PR
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIELDCI_TRIGGERED_BY is hardcoded to PR, but the workflow now runs on push and workflow_dispatch as well. Consider setting this based on github.event_name so dashboard data isn’t misclassified.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants