Skip to content

Commit 3e2a8f3

Browse files
Auto sync with Huggingface code space (#83)
Add a new workflow to sync the repository with Huggingface code space. * **Workflow**: Add `sync_huggingface.yml` in `.github/workflows/` to trigger on push and pull_request events for the main branch. Include steps to checkout the repository, set up Python, install dependencies, and sync with Huggingface using the Huggingface API key from `codespace_user_secrets.json`. * **Kubernetes Deployment**: Update `infra/k8s_deployment.yaml` and `infra/k8s/deployment.yaml` to add `HUGGINGFACE_API_KEY` environment variable to the `env` section, referencing the Huggingface API key from a secret. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/ProjectZeroDays/Project-Red-Sword/pull/83?shareId=563527a2-7442-428b-b2de-09a1b1c6c0d5).
2 parents b879d39 + 1a5ba83 commit 3e2a8f3

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Sync with Huggingface
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
sync:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -r requirements.txt
28+
29+
- name: Sync with Huggingface
30+
env:
31+
HUGGINGFACE_API_KEY: ${{ secrets.HUGGINGFACE_API_KEY }}
32+
run: |
33+
python sync_huggingface.py

infra/k8s/deployment.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
apiVersion: apps/v1
32
kind: Deployment
43
metadata:
@@ -18,3 +17,9 @@ spec:
1817
image: cybersecurity/framework:latest
1918
ports:
2019
- containerPort: 5000
20+
env:
21+
- name: HUGGINGFACE_API_KEY
22+
valueFrom:
23+
secretKeyRef:
24+
name: huggingface-secret
25+
key: api_key

infra/k8s_deployment.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
apiVersion: apps/v1
32
kind: Deployment
43
metadata:
@@ -24,3 +23,8 @@ spec:
2423
secretKeyRef:
2524
name: openai-secret
2625
key: api_key
26+
- name: HUGGINGFACE_API_KEY
27+
valueFrom:
28+
secretKeyRef:
29+
name: huggingface-secret
30+
key: api_key

0 commit comments

Comments
 (0)