diff --git a/.gitea/workflows/add-build-only-new.yml b/.gitea/workflows/add-build-only-new.yml new file mode 100644 index 000000000..5ac5f8fd1 --- /dev/null +++ b/.gitea/workflows/add-build-only-new.yml @@ -0,0 +1,39 @@ +name: Add build-only to new CI runners +on: push + +jobs: + add-label-1: + runs-on: [host, ci-check] + steps: + - name: add build-only label + run: | + HOSTNAME=$(hostname) + echo "Running on: $HOSTNAME" + + # 给所有6个Runner都加build-only标签(临时方案) + for i in 1 2 3 4 5 6; do + CONFIG_FILE="/opt/act-runner/runner-$i/.runner" + if [ -f "$CONFIG_FILE" ]; then + echo "Processing runner-$i..." + python3 -c " +import json +with open('$CONFIG_FILE', 'r') as f: + data = json.load(f) +labels = data.get('labels', []) +if 'build-only:host' not in labels: + labels.append('build-only:host') + data['labels'] = labels + with open('$CONFIG_FILE', 'w') as f: + json.dump(data, f, indent=2) + print(' Added build-only label') +else: + print(' Already has build-only') +" + # 重启服务 + systemctl restart act-runner-$i.service 2>&1 + echo " Restarted act-runner-$i" + fi + done + + sleep 5 + echo "Done on $HOSTNAME"