Skip to content

Commit 817c2b2

Browse files
Repository Setup
0 parents  commit 817c2b2

File tree

6 files changed

+263
-0
lines changed

6 files changed

+263
-0
lines changed

.circleci/config.yml

Whitespace-only changes.

.github/workflows/bandit-ci.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Bandit
2+
3+
on:
4+
# Scan changed files in PRs:
5+
pull_request: {}
6+
7+
jobs:
8+
bandit-scan:
9+
name: Bandit
10+
runs-on: ubuntu-22.04
11+
if: (github.actor != 'dependabot[bot]') && (github.actor != 'github-actions[bot]')
12+
steps:
13+
- name: Install PyCQA/bandit
14+
shell: bash
15+
run: |
16+
pip install bandit
17+
- name: Checkout base branch
18+
uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.event.pull_request.base.ref }}
21+
fetch-depth: 1
22+
submodules: false
23+
- name: Run a baseline scan
24+
shell: bash
25+
run: |
26+
bandit --recursive --aggregate file . -f json -o baseline.json || true
27+
- name: Checkout feature branch
28+
shell: bash
29+
run: |
30+
git fetch origin $GITHUB_HEAD_REF
31+
git checkout $GITHUB_HEAD_REF
32+
- name: Run Scan off of baseline
33+
shell: bash
34+
run: |
35+
bandit --recursive --aggregate file . --baseline baseline.json -f json -o results.json || true
36+
- name: Install logging prerequisites
37+
shell: bash {0}
38+
run: |
39+
sudo apt-get -y install jq curl
40+
- name: Generate logger template
41+
shell: bash {0} # don't fail the job if the logging fails
42+
run: |
43+
jq -n --arg organization $GITHUB_REPOSITORY_OWNER \
44+
-n --arg time $( date +'%Y-%m-%dT%H:%M:%SZ' ) \
45+
-n --arg action $GITHUB_WORKFLOW \
46+
-n --arg repository $GITHUB_REPOSITORY \
47+
-n --arg sha $GITHUB_SHA \
48+
-n --arg branch $GITHUB_HEAD_REF \
49+
-n --arg link "https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
50+
-f .github/workflows/output-template.json > tmp-output.json
51+
- name: Format results appropriately from results.json
52+
shell: bash {0} # don't fail the job if the logging fails
53+
run: |
54+
jq '.results | map({"path": .filename, "message": .issue_text, "line": .line_number})' results.json > tmp.json
55+
jq --argjson scanResults "$(<tmp.json)" '.results += $scanResults' tmp-output.json > output.json
56+
- name: Send unified results to logging cluster
57+
shell: bash {0} # don't fail the job if the logging fails
58+
run: |
59+
curl -X POST \
60+
-H "Content-Type: application/json" \
61+
-H "Authorization: Bearer ${{ secrets.N8N_PRODSEC_ACTIONS_TOKEN }}" \
62+
-d @./output.json \
63+
${{ secrets.N8N_PRODSEC_ACTIONS_ENDPOINT }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"source": "github",
3+
"organization": "\($organization)",
4+
"timestamp": "\($time)",
5+
"action": "\($action)",
6+
"meta": {
7+
"repository": "\($repository)",
8+
"commit": "\($sha)",
9+
"branch": "\($branch)",
10+
"link": "\($link)"
11+
},
12+
"results": []
13+
}

.gitignore

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
*.pth
6+
7+
# Runtime data
8+
pids
9+
*.pid
10+
*.seed
11+
*.pid.lock
12+
13+
# IntelliJ
14+
**/.idea
15+
*.iml
16+
17+
# VSCode
18+
.vscode
19+
*.code-workspace
20+
21+
# filesystem files
22+
.DS_Store
23+
24+
# Local environment files
25+
*.env
26+
.env.*
27+
*.envrc
28+
frontend/.npmrc
29+
local*.yaml
30+
31+
# filesystem databases
32+
dump.rdb
33+
*.sqlite
34+
*.db
35+
36+
# Temp dirs
37+
tmp
38+
39+
### PYTHON
40+
41+
# Byte-compiled / optimized / DLL files
42+
__pycache__/
43+
*.py[cod]
44+
*$py.class
45+
46+
# C extensions
47+
*.so
48+
49+
# Distribution / packaging
50+
.Python
51+
build/
52+
develop-eggs/
53+
dist/
54+
downloads/
55+
eggs/
56+
.eggs/
57+
lib/
58+
lib64/
59+
parts/
60+
sdist/
61+
var/
62+
wheels/
63+
share/python-wheels/
64+
*.egg-info/
65+
.installed.cfg
66+
*.egg
67+
MANIFEST
68+
69+
# PyInstaller
70+
# Usually these files are written by a python script from a template
71+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
72+
*.manifest
73+
*.spec
74+
75+
# Installer logs
76+
pip-log.txt
77+
pip-delete-this-directory.txt
78+
79+
# Unit test / coverage reports
80+
htmlcov/
81+
.tox/
82+
.nox/
83+
.coverage
84+
.coverage.*
85+
.cache
86+
nosetests.xml
87+
coverage.xml
88+
*.cover
89+
*.py,cover
90+
.hypothesis/
91+
.pytest_cache/
92+
cover/
93+
94+
# Translations
95+
*.mo
96+
*.pot
97+
98+
# Django stuff:
99+
*.log
100+
local_settings.py
101+
db.sqlite3
102+
db.sqlite3-journal
103+
104+
# Flask stuff:
105+
instance/
106+
.webassets-cache
107+
108+
# Scrapy stuff:
109+
.scrapy
110+
111+
# Sphinx documentation
112+
docs/_build/
113+
114+
# PyBuilder
115+
.pybuilder/
116+
target/
117+
118+
# Jupyter Notebook
119+
.ipynb_checkpoints
120+
_temp_extension
121+
junit.xml
122+
[uU]ntitled*
123+
notebook/static/*
124+
!notebook/static/favicons
125+
notebook/labextension
126+
notebook/schemas
127+
docs/source/changelog.md
128+
docs/source/contributing.md
129+
130+
# IPython
131+
profile_default/
132+
ipython_config.py
133+
134+
# pyenv
135+
# For a library or package, you might want to ignore these files since the code is
136+
# intended to run in multiple environments; otherwise, check them in:
137+
# .python-version
138+
139+
# pipenv
140+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
141+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
142+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
143+
# install all needed dependencies.
144+
#Pipfile.lock
145+
146+
# pdm
147+
.pdm.toml
148+
149+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
150+
__pypackages__/
151+
152+
# Environments
153+
.env
154+
.venv
155+
env/
156+
venv/
157+
ENV/
158+
env.bak/
159+
venv.bak/
160+
161+
# mypy
162+
.mypy_cache/
163+
.dmypy.json
164+
dmypy.json
165+
166+
# Pyre type checker
167+
.pyre/
168+
169+
# pytype static type analyzer
170+
.pytype/
171+
172+
# Cython debug symbols
173+
cython_debug/

CODEOWNERS

Whitespace-only changes.

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# repository-template
2+
A repository template for repository creation at Scale AI.
3+
4+
## Usage
5+
### Automatic
6+
Request a new repository from the slackbot `Onyx` using `/onyx` and input the appropriate information such as desired language(s)
7+
8+
### Manual
9+
Requires repository creation permissions and an appropriately-permissioned REPO_SETUP_TOKEN
10+
11+
1. Create a new repository using this template
12+
2. Add a secret `REPO_SETUP_TOKEN` to the new repository
13+
3. Run the GitHub workflow `repository-setup`, inputting parameters as desired.
14+
4. Allow the workflow to run and set up language-specific files and settings.

0 commit comments

Comments
 (0)