Skip to content

Commit fd74095

Browse files
chore: adding leak detect (#492)
1 parent 974b379 commit fd74095

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/leak_detect.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Detect Project ID leak
2+
3+
# Controls when the workflow will run
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the main branch
6+
push:
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
# This workflow contains a single job called "build"
14+
check:
15+
# The type of runner that the job will run on
16+
runs-on: ubuntu-latest
17+
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
steps:
20+
- name: Checkout github repo (+ download lfs dependencies)
21+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22+
uses: actions/checkout@v2
23+
with:
24+
lfs: true
25+
- name: Checkout LFS objects # needs to be done as a second step, lfs:true above just sets references, but doesn't actually dereference them...
26+
run: git lfs checkout
27+
# Find in project settings if there's any value in between "cloudProjectId: " and end of line. This exits 1 and fails the step if there's text there.
28+
- name: Run a one-line script
29+
run: python3 -c "import re; import sys;content=open('ProjectSettings/ProjectSettings.asset').read();res = re.search(r'.*cloudProjectId:.*\w+\s*\n', content)!=None;status = 1 if res else 0; print('status '+str(status)); sys.exit(res)"
30+
- name: Post to slack on failure
31+
if: ${{ failure() }}
32+
uses: slackapi/[email protected]
33+
with:
34+
# Slack channel id, channel name, or user id to post message.
35+
# See also: https://api.slack.com/methods/chat.postMessage#channels
36+
channel-id: 'G01H7JP4AP2' # private channel
37+
# For posting a simple plain text message
38+
slack-message: "Project ID LEAK DETECTED: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
39+
env:
40+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} # can be found in https://api.slack.com/apps/

0 commit comments

Comments
 (0)