Skip to content

Commit 2572bf9

Browse files
authored
Modify workflow and main (#101)
1 parent 4aeb4c8 commit 2572bf9

3 files changed

Lines changed: 25 additions & 26 deletions

File tree

.github/workflows/dagger_hackathon.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ jobs:
1111
GITHUB_TOKEN: ${{ secrets.DAGGER_HACKATHON_GITHUB_TOKEN }}
1212
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
1313
CURRENT_BRANCH: ${{ github.head_ref }}
14+
CURRENT_REPO: ${{ github.repository }}
15+
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
16+
AZURE_OPENAI_ENDPOINT: https://vdfvdf.openai.azure.com/
1417

1518
steps:
1619
- name: Checkout repo
@@ -25,25 +28,24 @@ jobs:
2528
working-directory: docs/dagger/dagger-hackathon/
2629
run: |
2730
cat <<EOF > .env
28-
OPENAI_BASE_URL=https://vdfvdf.openai.azure.com/
31+
OPENAI_BASE_URL=${AZURE_OPENAI_ENDPOINT}
2932
OPENAI_MODEL=gpt-4o
3033
OPENAI_API_KEY=${OPENAI_API_KEY}
3134
OPENAI_AZURE_VERSION=2024-12-01-preview
32-
GITHUB_TOKEN=${GITHUB_TOKEN}
3335
EOF
3436
3537
- name: Dagger Run Unit Tests
3638
working-directory: docs/dagger/dagger-hackathon/
37-
env:
38-
DAGGER_SECRET_GITHUB_TOKEN: ${{ secrets.DAGGER_HACKATHON_GITHUB_TOKEN }}
3939
run: |
4040
export AZURE_OPENAI_API_KEY="${OPENAI_API_KEY}"
41-
export AZURE_OPENAI_ENDPOINT="https://vdfvdf.openai.azure.com/"
41+
export GITHUB_TOKEN="${GITHUB_TOKEN}"
42+
export DAGGER_CLOUD_TOKEN="${DAGGER_CLOUD_TOKEN}"
4243
dagger call \
4344
--source="." \
4445
--github_branch="${CURRENT_BRANCH}" \
45-
--github_repo="codetocloudorg/platform-engineering" \
46-
--github_token=DAGGER_SECRET_GITHUB_TOKEN \
47-
--azure_api_key="OPENAI_API_KEY" \
48-
--azure_endpoint="https://vdfvdf.openai.azure.com/" \
46+
--github_repo="${CURRENT_REPO}" \
47+
--github_token=GITHUB_TOKEN \
48+
--azure_openai_api_key=AZURE_OPENAI_API_KEY \
49+
--azure_openai_endpoint="${AZURE_OPENAI_ENDPOINT}" \
4950
fix-my-tests-agent
51+

docs/dagger/dagger-hackathon/README.md

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Welcome to the Dagger hackathon hosted by the [CNCF](https://community.cncf.io/cloud-native-calgary/) and [Code to Cloud](https://www.codetocloud.io/)! By the end of this hack, you will have a good understanding of how to use Dagger and the various use cases it can help support.
44

5-
👀 Here’s the end-to-end flow:
5+
**👀 Here’s the end-to-end flow:**
66

77
![image](./assets/hack-overview.jpeg)
88

@@ -16,7 +16,7 @@ Welcome to the Dagger hackathon hosted by the [CNCF](https://community.cncf.io/c
1616

1717
5️⃣ Dagger agent inspects the issue using smart tools 🔍
1818

19-
6️⃣ A helpful comment appears on the PR 💬
19+
6️⃣ A suggested code change appears on the PR 💬
2020

2121
## 🎯 Expected Outcomes
2222

@@ -116,7 +116,7 @@ The below steps will take you through making a breaking change to a file in our
116116
```
117117
and confirm it fails
118118
- Push the modified `addition.py` to your new feature branch
119-
- In the GitHub UI, open a PR on the feature branch and compare to `main`
119+
- In the GitHub UI, **open a PR** on the feature branch and compare to `main` (make sure to compare to `main` and not forked `main`)
120120

121121
---
122122

@@ -125,21 +125,16 @@ The below steps will take you through making a breaking change to a file in our
125125
<img src="./assets/spongebob_meme.jpg" alt="spongebob" width="400"/>
126126

127127
- Rename `docs/dagger/dagger-hackathon/.env-example` to `.env`
128-
- Populate the placeholder keys with real values (we will provide for Hackathon day)
128+
- Populate the placeholder keys with real values (we will provide the full API key during the hackathon)
129+
- `OPENAI_API_KEY`: FT0Dd0iIglkzGbizOMUp79k0Frea7neDtVXRhFZ5m39CJJJcdfxFJQQJ99BEACYeBjFXJ3w3AAABACO
130+
- `OPENAI_BASE_URL`: https://vdfvdf.openai.azure.com/
129131
- Create environment variables for `GITHUB_TOKEN` and `AZURE_OPENAI_API_KEY`
130-
A GitHub Token can be created in GitHub under Settings → Developer Settings → Create a classic token
132+
A GitHub Token can be created in GitHub under Settings → Developer Settings → Create a classic token (you must have repo and workflow scopes)
131133
Example:
132134
```bash
133135
export GITHUB_TOKEN="XXX"
134136
```
135-
The Azure OpenAI details can be found below:
136-
137-
- Azure OpenAI API Key: FT0Dd0iIglkzGbizOMUp79k0Frea7neDtVXRhFZ5m39CJJJcdfxFJQQJ99BEACYeBjFXJ3w3AAABACO
138-
- Azure OpenAI Endpoint: https://vdfvdf.openai.azure.com/
139-
140-
> **Note:** The full API key will be provided during the hackathon.
141-
142-
- Put in your values and run in CLI:
137+
- Fill in values for `github_branch`, `github_repo`, and `azure_openai_endpoint` (same as `OPENAI_BASE_URL`) and run in CLI:
143138
```bash
144139
dagger call \
145140
--source="." \
@@ -192,8 +187,8 @@ Being able to navigate and explore logs in Dagger Cloud is a great skill to have
192187

193188
### ✅ Step 8: Trigger GitHub Action
194189

195-
- Delete the comment the Agent left on the PR in Step 6
196-
- [Create GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) for everything in `.env` and name them `DAGGER_HACKATHON_GITHUB_TOKEN` and `OPENAI_API_KEY` for the GitHub token and Azure OpenAI API key respectively.
190+
- Delete any comments the Agent left on the PR in Step 6
191+
- [Create GitHub secrets](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) for `DAGGER_CLOUD_TOKEN`, `DAGGER_HACKATHON_GITHUB_TOKEN` (what was `GITHUB_TOKEN`), and `OPENAI_API_KEY`.
197192
- Make sure to update your GitHub Action to trigger on a pull request instead of a manual trigger.
198193

199194
Update the trigger from this:
@@ -211,7 +206,9 @@ on:
211206
types: [opened, synchronize, reopened]
212207
```
213208
214-
- Push your changes to Git and navigate back to your forked repo to see the GitHub Action running
209+
- Push your changes to Git
210+
211+
- Now break the code in a different way in `addition.py` and push those changes. You should see a action running.
215212

216213
![image](./assets/run_unit_tests.png)
217214

docs/dagger/dagger-hackathon/dagger-hackathon-pipeline/src/dagger_hackathon/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ async def GetPrMetadata(self) -> PrMetadataResult:
6767
"--head", f"{self.github_branch}",
6868
"--limit", "1",
6969
"--json", "number",
70-
"--jq", ".[0].number",
70+
"--jq", ".[].number",
7171
"--repo", f"{self.github_repo}"
7272
])
7373
.stdout()

0 commit comments

Comments
 (0)