This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
forked from hypertrace/hypertrace-ingester
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a5329ac
commit f0c4f5d
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Security Checks | ||
on: | ||
workflow_dispatch: | ||
pull_request: {} | ||
push: | ||
branches: ["rzp_main"] | ||
schedule: | ||
- cron: '30 20 * * *' | ||
jobs: | ||
semgrep: | ||
name: Scan | ||
runs-on: [ubuntu-latest] #nosemgrep zklW | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: returntocorp/semgrep-action@v1 | ||
with: | ||
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} | ||
publishDeployment: 339 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
workflow_status: | ||
runs-on: [ ubuntu-latest ] #nosemgrep zklW | ||
name: Update Status Check | ||
needs: [ semgrep ] | ||
if: always() | ||
env: | ||
githubCommit: ${{ github.event.pull_request.head.sha }} | ||
steps: | ||
- name: Set github commit id | ||
run: | | ||
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "schedule" ]; then | ||
echo "githubCommit=${{ github.sha }}" >> $GITHUB_ENV | ||
fi | ||
exit 0 | ||
- name: Failed | ||
id: failed | ||
if: (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && github.ref != 'refs/heads/master' | ||
run: | | ||
echo 'Failing the workflow for github security status check.' | ||
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ | ||
-d '{ "state" : "failure" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ | ||
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} | ||
exit 1 | ||
- name: Success | ||
if: steps.failed.conclusion == 'skipped' || github.ref != 'refs/heads/master' | ||
run: | | ||
echo 'Status check has passed!' | ||
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ | ||
-d '{ "state" : "success" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ | ||
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} | ||
exit 0 |