Skip to content

Commit 9565579

Browse files
committed
Added a comment action and fix async issue in python script
1 parent 1234aac commit 9565579

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

.github/scripts/build_assets/SeleniumRunner.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ def set_options(self, download_path: str, geckodriver_path: str,
7575
self.driver = WebDriver(options=options, executable_path=geckodriver_path)
7676
self.driver.get(self.ICOMOON_URL)
7777
assert "IcoMoon App" in self.driver.title
78+
79+
# wait until the whole web page is loaded by testing the hamburger input
80+
hamburger_input = WebDriverWait(self.driver, SeleniumRunner.LONG_WAIT_IN_SEC).until(
81+
ec.element_to_be_clickable((By.CSS_SELECTOR,
82+
"button.btn5.lh-def.transparent i.icon-menu"))
83+
)
84+
hamburger_input.click()
85+
print("Accessed icomoon.io")
7886

7987
def upload_icomoon(self, icomoon_json_path: str):
8088
"""
@@ -86,7 +94,7 @@ def upload_icomoon(self, icomoon_json_path: str):
8694
try:
8795
# find the file input and enter the file path
8896
import_btn = WebDriverWait(self.driver, SeleniumRunner.LONG_WAIT_IN_SEC).until(
89-
ec.presence_of_element_located((By.CSS_SELECTOR, "div#file input"))
97+
ec.element_to_be_clickable((By.CSS_SELECTOR, "div#file input"))
9098
)
9199
import_btn.send_keys(icomoon_json_path)
92100
except Exception as e:
@@ -138,6 +146,7 @@ def upload_svgs(self, svgs: List[str]):
138146
ec.element_to_be_clickable((By.XPATH, "//button[text()='Select All']"))
139147
)
140148
select_all_button.click()
149+
print("Finished uploading the svgs...")
141150
except Exception as e:
142151
self.close()
143152
raise e
@@ -155,7 +164,7 @@ def click_hamburger_input(self):
155164
)
156165

157166
menu_appear_callback = ec.element_to_be_clickable(
158-
(By.CSS_SELECTOR, "h1#setH2 ul")
167+
(By.CSS_SELECTOR, "h1 ul.menuList2")
159168
)
160169

161170
while not menu_appear_callback(self.driver):

.github/workflows/peek_icons.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,9 @@ jobs:
2121
python -m pip install --upgrade pip
2222
pip install -r ./.github/scripts/requirements.txt
2323
npm install
24-
<<<<<<< HEAD
2524
- name: Run icomoon_peek.py
2625
run: >
2726
python ./.github/scripts/icomoon_peek.py
28-
=======
29-
- name: Run icomoon_upload.py
30-
run: >
31-
python ./.github/scripts/icomoon_upload.py
32-
>>>>>>> 89412c2... Added a peek script
3327
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe
3428
./icomoon.json ./devicon.json ./icons ./ --headless
3529
- name: Upload geckodriver.log for debugging purposes
@@ -43,14 +37,12 @@ jobs:
4337
if: ${{success()}}
4438
with:
4539
name: new_icons
46-
<<<<<<< HEAD
47-
path: ./new_icons.png
48-
=======
4940
path: ./new_icons.png
50-
- name: Create a comment alerting that the bot peeked
51-
uses: peter-evans/commit-comment@v1
41+
- name: Comment on the PR about the result
42+
uses: github-actions-up-and-running/pr-comment@v1.0.1
5243
with:
53-
body: >
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
message: >
5446
Hi! I'm Devicons' GitHub Actions Bot!
5547
5648
I just peeked at the icons that you wanted to add and upload them to the
@@ -59,4 +51,3 @@ jobs:
5951
6052
Cheers :),
6153
Bot
62-
>>>>>>> 89412c2... Added a peek script

0 commit comments

Comments
 (0)