Skip to content

Commit 895ba2a

Browse files
author
Jeremy Dai
authored
Test automation (#13)
* Simplify workflow: test-automation branch, pass issue body * remove ref * update
1 parent 1b37618 commit 895ba2a

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

.github/workflows/auto-update.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
name: Create Server JSON and Update Repo
1+
name: Scrape and Update Repo
22

33
on:
44
issues:
55
types: [labeled]
66

77
jobs:
8-
create-json-and-update:
8+
scrape-and-update:
99
runs-on: ubuntu-latest
10-
if: github.event.label.name == 'new-server'
10+
if: github.event.label.name == 'new-server' # Trigger only on 'new-server' label
1111
steps:
1212
- name: Check if user is authorized
1313
env:
1414
SENDER: ${{ github.event.sender.login }}
1515
run: |
1616
# Custom list of authorized users (GitHub usernames)
17-
AUTHORIZED_USERS="jeremy-dai-txyz JoJoJoJoJoJoJo niechen"
17+
AUTHORIZED_USERS="jeremy-dai-txyz JoJoJoJoJoJoJo niechen"
1818
if echo "$AUTHORIZED_USERS" | grep -q -w "$SENDER"; then
1919
echo "User $SENDER is authorized"
2020
else
2121
echo "User $SENDER is not authorized"
22-
exit 1 # Fail the workflow if unauthorized
22+
exit 1
2323
fi
2424
2525
- name: Checkout repository
@@ -28,23 +28,34 @@ jobs:
2828
- name: Set up Python
2929
uses: actions/setup-python@v5
3030
with:
31-
python-version: '3.x'
31+
python-version: '3.13'
3232

3333
- name: Install dependencies
3434
run: |
3535
python -m pip install --upgrade pip
36-
pip install requests openai
36+
pip install requests
3737
38-
- name: Run the script
38+
- name: Create local directory
39+
run: mkdir -p local
40+
41+
- name: Run Script with Issue Body
3942
env:
4043
ISSUE_BODY: ${{ github.event.issue.body }}
44+
shell: /usr/bin/bash -e {0}
4145
run: |
46+
echo "Running get_manifest.py with issue body"
4247
python scripts/get_manifest.py "$ISSUE_BODY"
4348
44-
- name: Commit the new content
49+
- name: Create and push new branch
50+
env:
51+
ISSUE_NUMBER: ${{ github.event.issue.number }}
52+
shell: /usr/bin/bash -e {0}
4553
run: |
54+
# Create a unique branch name with issue number
55+
BRANCH_NAME="scrape-issue-$ISSUE_NUMBER"
4656
git config user.name "GitHub Action"
4757
git config user.email "[email protected]"
48-
git add .
49-
git commit -m "Update repo with JSON content from issue #${{ github.event.issue.number }}" || echo "No changes to commit"
50-
git push
58+
git checkout -b "$BRANCH_NAME"
59+
git add local/readme.md
60+
git commit -m "Update repo with README from issue #$ISSUE_NUMBER" || echo "No changes to commit"
61+
git push origin "$BRANCH_NAME" --force # Push to the new branch

0 commit comments

Comments
 (0)