Browse Source

add: ci报错加上最后一次commit的信息

chenxuuu 4 years ago
parent
commit
8f0a49347e

+ 1 - 1
.github/workflows/air100st.yml

@@ -62,6 +62,6 @@ jobs:
         MQTTPORT: ${{ secrets.MQTTPORT }}
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
-        sudo pip3 install paho_mqtt
+        sudo pip3 install paho_mqtt gitpython
         cd tools
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "air100st https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 1 - 1
.github/workflows/air101.yml

@@ -55,6 +55,6 @@ jobs:
         MQTTPORT: ${{ secrets.MQTTPORT }}
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
-        sudo pip3 install paho_mqtt
+        sudo pip3 install paho_mqtt gitpython
         cd tools
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "air101 https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 1 - 1
.github/workflows/air105.yml

@@ -53,6 +53,6 @@ jobs:
         MQTTPORT: ${{ secrets.MQTTPORT }}
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
-        sudo pip3 install paho_mqtt
+        sudo pip3 install paho_mqtt gitpython
         cd tools
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "air105 https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 1 - 1
.github/workflows/air640w.yml

@@ -60,6 +60,6 @@ jobs:
         MQTTPORT: ${{ secrets.MQTTPORT }}
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
-        sudo pip3 install paho_mqtt
+        sudo pip3 install paho_mqtt gitpython
         cd tools
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "air640w https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 1 - 1
.github/workflows/pico.yml

@@ -47,6 +47,6 @@ jobs:
         MQTTPORT: ${{ secrets.MQTTPORT }}
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
-        sudo pip3 install paho_mqtt
+        sudo pip3 install paho_mqtt gitpython
         cd tools
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "pico https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 1 - 1
.github/workflows/win32.yml

@@ -54,5 +54,5 @@ jobs:
         MQTTTOPIC: ${{ secrets.MQTTTOPIC }}
       run: |
         cd tools
-        pip install paho-mqtt -t ./
+        pip install paho-mqtt gitpython -t ./
         if [ "$STATUS" = "failure" ];then python3 ciNotify.py $MQTTADDR $MQTTPORT $MQTTTOPIC "win32 https://github.com/openLuat/LuatOS/actions/runs/$GITHUB_RUN_ID"; fi

+ 3 - 1
tools/ciNotify.py

@@ -1,13 +1,15 @@
 import sys
 import paho.mqtt.client as mqtt
 import paho.mqtt.publish as publish
+from git import Repo
 
 client = mqtt.Client()
+repo = Repo("./")
 try:
     #服务器请自行修改,需要传入参数
     client.connect(sys.argv[1], int(sys.argv[2]), 60)
     #topic请根据需要自行修改,需要传入参数
-    pub = client.publish(sys.argv[3],sys.argv[4])
+    pub = client.publish(sys.argv[3],sys.argv[4]+"\r\n"+repo.head.commit.name+"-"+repo.head.commit.author.message)
     pub.wait_for_publish()
     client.disconnect()
     print("sent")