|
1 | | -## Introduction |
| 1 | +## Introduction 🛎️ |
2 | 2 | ### Workflow |
3 | 3 | #### Project 1: Pull Request Suggestion |
4 | 4 | - Workflow UML for demo |
|
12 | 12 | - Workflow UML for development |
13 | 13 |  |
14 | 14 |
|
15 | | -## Instruction |
| 15 | +## Instruction 📐 |
16 | 16 | ### Generate OPEN AI Credentials |
17 | 17 | 1. Log in [Azure Portal](https://portal.azure.com/#@adobe.onmicrosoft.com/resource/subscriptions/144eeab3-93ab-462c-9ed5-8ba04c159339/resourceGroups/ioevents-nonprod/providers/Microsoft.CognitiveServices/accounts/ioevents-openai-test/overview) with Adobe account |
18 | 18 | 2. Click "Explore azure AI foundry portal" |
19 | 19 |  |
20 | 20 | 3. Click "Create new deployment" -> "From base models" |
21 | 21 |  |
22 | | -4. Select a model (recomment gpt4.1) |
| 22 | +4. Select a model (recomment gpt4.1, but we can try gpt5 as well 🤩) |
23 | 23 | 5. Click "Confirm" |
24 | 24 |  |
25 | 25 | 6. Edit the Deployment Name and Deploy |
|
40 | 40 |  |
41 | 41 | 4. Click "personal Access Tokens" -> "Tokens(classic)" -> "Generate new token" |
42 | 42 |  |
43 | | -5. To run the program on local machine, run `export GITHUB_TOKEN="<replace with your token>"` |
| 43 | +5. Grant at least read and write access to the token |
| 44 | +6. To run the program on local machine, run `export GITHUB_TOKEN="<replace with your token>"` |
44 | 45 | > 💡Note: Github Token is only used for Github API call in local development. Without an github token in REST API header, Github will limit the read access for 60 requests/hour, and no edit aceess allowed. |
45 | 46 |
|
46 | 47 | ### Store Scretes in Git Repo |
|
50 | 51 | 3. Click "New Repository Secrete" to add secreates / Click one Secreate's name to overwrite secreate |
51 | 52 |  |
52 | 53 |
|
| 54 | +## Run the Program 💻 |
| 55 | +### Local Environment |
| 56 | +#### PR suggestion |
| 57 | +1. Set up the local environment: |
| 58 | + - Github Token: run `export GITHUB_TOKEN="<replace with your token>"` |
| 59 | + - Azure Open AI endpoint: run `export export AZURE_OPENAI_ENDPOINT="<replace with you azure endpoint>"` |
| 60 | + - Azure Open AI API key: run `export export AZURE_OPENAI_API_KEY="<replace with you azure API key>"` |
| 61 | + - File Path: run `export FILE_NAME="all_pages_content.txt"` (this is because both workflow shares ai-scripts.js, so need to differentiate file name to avoid duplication of code) |
| 62 | +2. Download dependencies |
| 63 | + - run `npm install`, or `yarn install` if npm doesn't work |
| 64 | +3. Run scripts one by one following deploy.yml |
| 65 | + - run `node src/pr-scripts.js` |
| 66 | + - run `node src/ai-scripts.js` |
| 67 | + - run `node src/review-scripts.js` |
| 68 | +4. Checkout the target Pull Request, the AI suggestion should be there |
53 | 69 |
|
| 70 | +#### AI metadata for all pages |
| 71 | +1. Set up the local environment: |
| 72 | + - Github Token: run `export GITHUB_TOKEN="<replace with your token>"` |
| 73 | + - Azure Open AI endpoint: run `export export AZURE_OPENAI_ENDPOINT="<replace with you azure endpoint>"` |
| 74 | + - Azure Open AI API key: run `export export AZURE_OPENAI_API_KEY="<replace with you azure API key>"` |
| 75 | + - Pull Request id: run `export PR_ID="<replace with pr id>"` |
| 76 | + - File Path: run `export FILE_NAME="pr_content.txt"` (this is because both workflow shares ai-scripts.js, so need to differentiate file name to avoid duplication of code) |
| 77 | +2. Download dependencies |
| 78 | + - run `npm install`, or `yarn install` if npm doesn't work |
| 79 | +3. Run scripts one by one following test/pull-request.yml |
| 80 | + - run `node src/fetch-pages-scripts.js` |
| 81 | + - run `node src/ai-scripts.js` |
| 82 | + - run `node src/create-pr-scripts.js` |
| 83 | +4. Checkout the git repo, the new created PR should be opened |
| 84 | + |
| 85 | +### Github Action |
| 86 | +#### PR suggestion |
| 87 | +1. Set up secretes in github repo |
| 88 | + - AZURE_OPENAI_ENDPOINT |
| 89 | + - Azure_OPENAI_API_KEY |
| 90 | + - (no need for github token, github action will provide one for itself) |
| 91 | +2. Create a pull request targeting to main branch with markdown changes in src/pages |
| 92 | +3. To run the program again, just close and repoen the pull request |
| 93 | + |
| 94 | +#### AI metadata for all pages |
| 95 | +1. Set up secretes in github rep |
| 96 | + - AZURE_OPENAI_ENDPOINT |
| 97 | + - Azure_OPENAI_API_KEY |
| 98 | + - (no need for github token, github action will provide one for itself) |
| 99 | +2. deploy the main branch in github action |
| 100 | + |
| 101 | +## Further Development Note ✏️ |
| 102 | +- The markdown files with components are skipped for now, need to update them if we find a way to get raw information inside the components |
| 103 | +- The github repo related variables (owner, repo, ref ...) are hard coded, need to be updated for production |
| 104 | +- The PR suggestion workflow is defined in test-pull-request.yml, and the AI metadata for all pages is defined in deploy.yml. They may need to be seperated. |
| 105 | +- AI metadata for all pages workflow will create a PR targeting to main branch, which will trigger pr suggestion workflow. Pr suggestion may not appear everytime since the AI prompt requested "minimum amount of necessary change", we may need to refine the prompt to fix it? Another way is to add another condition to PR suggestion: "if the PR is created by github bot, then skip this workflow". |
| 106 | + |
| 107 | + |
| 108 | +> For any other questions, please feel free to reach out to me 🌽 |
| 109 | +[School Email ]([email protected]): actively checking before Nov 2025 (if no response in 2 hours, either in exam 📝 or in game raid 🎮) |
| 110 | +[Personal Email ]([email protected]): checking daily |
0 commit comments