@@ -16,13 +16,20 @@ jobs:
1616 - name : Checkout target repository
1717 uses : actions/checkout@v4
1818
19- - name : Get PR metadata
19+ - name : Gather metadata
2020 id : meta
2121 run : |
2222 echo "repo=${{ github.repository }}" >> "$GITHUB_OUTPUT"
23- echo "branch=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
24- echo "commit=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
25- echo "commit_msg=$(git log -1 --pretty=%s 2>/dev/null || echo 'PR scan')" >> "$GITHUB_OUTPUT"
23+ if [ "${{ github.event_name }}" = "pull_request" ]; then
24+ echo "branch=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
25+ echo "commit=${{ github.event.pull_request.head.sha }}" >> "$GITHUB_OUTPUT"
26+ echo "trigger=PR" >> "$GITHUB_OUTPUT"
27+ else
28+ echo "branch=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
29+ echo "commit=${{ github.sha }}" >> "$GITHUB_OUTPUT"
30+ echo "trigger=${{ github.event_name }}" >> "$GITHUB_OUTPUT"
31+ fi
32+ echo "commit_msg=$(git log -1 --pretty=%s 2>/dev/null || echo 'scan')" >> "$GITHUB_OUTPUT"
2633
2734 - name : Check ShieldCI engine is available
2835 run : |
@@ -54,19 +61,21 @@ jobs:
5461 - name : Push results to ShieldCI dashboard
5562 if : always()
5663 env :
57- SHIELDCI_API_URL : ${{ secrets.SHIELDCI_API_URL }}
58- SHIELDCI_API_KEY : ${{ secrets.SHIELDCI_API_KEY }}
64+ SHIELDCI_API_URL : http://localhost:3000/api/scans
65+ SHIELDCI_API_KEY : fc09420a3737855a3094ff7831a6219565cee6777a0fbeec
5966 SHIELDCI_REPO : ${{ steps.meta.outputs.repo }}
6067 SHIELDCI_BRANCH : ${{ steps.meta.outputs.branch }}
6168 SHIELDCI_COMMIT : ${{ steps.meta.outputs.commit }}
6269 SHIELDCI_COMMIT_MSG : ${{ steps.meta.outputs.commit_msg }}
6370 SHIELDCI_DURATION : ${{ steps.scan.outputs.duration }}
64- SHIELDCI_TRIGGERED_BY : PR
65- SHIELDCI_RESULTS_FILE : $HOME/Desktop/ShieldCI/tests/shield_results.json
66- run : python3 "$HOME/Desktop/ShieldCI/push_results.py"
71+ SHIELDCI_TRIGGERED_BY : ${{ steps.meta.outputs.trigger }}
72+ SHIELDCI_RESULTS_FILE : ${{ runner.temp }}/../../../Desktop/ShieldCI/tests/shield_results.json
73+ run : |
74+ export SHIELDCI_RESULTS_FILE="$HOME/Desktop/ShieldCI/tests/shield_results.json"
75+ python3 "$HOME/Desktop/ShieldCI/push_results.py"
6776
6877 - name : Post scan summary as PR comment
69- if : always()
78+ if : github.event_name == 'pull_request'
7079 uses : actions/github-script@v7
7180 with :
7281 script : |
0 commit comments