Skip to content

Commit e66c282

Browse files
authored
Merge pull request #54 from hathach/trigger-libraries
add workflow that trigger libraries rebuild
2 parents 09272e1 + c86721c commit e66c282

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Trigger Libraries
2+
3+
on:
4+
push:
5+
branches: gh-pages
6+
paths: 'package_adafruit_index.json'
7+
8+
jobs:
9+
trigger-libraries:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Setup Python
13+
uses: actions/setup-python@v1
14+
with:
15+
python-version: '3.x'
16+
17+
- name: Checkout code
18+
uses: actions/checkout@v2
19+
20+
- name: Trigger Script
21+
env:
22+
GH_REPO_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
23+
run: python3 examples/trigger_libraries.py
24+

examples/trigger_libraries.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import os
2+
import shutil
3+
import sys
4+
import subprocess
5+
import time
6+
7+
# sorted alphabetically
8+
all_libs = [
9+
'Adafruit_9DOF',
10+
'Adafruit_ADXL343',
11+
'Adafruit_Arcada',
12+
'Adafruit_BME280_Library',
13+
'Adafruit_BMP280_Library',
14+
'Adafruit_BusIO',
15+
'Adafruit_EPD',
16+
'Adafruit-GFX-Library',
17+
'Adafruit_ICM20649',
18+
'Adafruit_ILI9341',
19+
'Adafruit_ImageReader',
20+
'Adafruit_INA260',
21+
'Adafruit_LIS2MDL',
22+
'Adafruit_LIS3MDL',
23+
'Adafruit_LSM303_Accel',
24+
'Adafruit_LSM303DLH_Mag',
25+
'Adafruit_LSM6DS',
26+
'Adafruit_MAX31865',
27+
'Adafruit_MCP4728',
28+
'Adafruit_MLX90640',
29+
'Adafruit_MSA301',
30+
'Adafruit_NeoPixel_ZeroDMA',
31+
'Adafruit_Sensor',
32+
'Adafruit_SensorLab',
33+
'Adafruit_SPIFlash',
34+
'Adafruit-ST7735-Library',
35+
'Adafruit_TinyUSB_Arduino',
36+
]
37+
38+
GH_REPO_TOKEN = os.environ["GH_REPO_TOKEN"]
39+
40+
gh_request = 'curl -X POST -H "Authorization: token {}"'.format(GH_REPO_TOKEN) + \
41+
' -H "Accept: application/vnd.github.everest-preview+json"' + \
42+
' -H "Content-Type: application/json"' + \
43+
' --data \'{"event_type": "rebuild"}\' '
44+
45+
url = 'https://api.github.com/repos/adafruit/{}/dispatches'
46+
47+
for lib in all_libs:
48+
subprocess.run(gh_request + url.format(lib), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

0 commit comments

Comments
 (0)