Add files via upload #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author:Levi | |
# 搭配convert js to sgmodule.py使用。可将qx的js/conf/snippet文件转换为sgmodule文件。使用方法见博客。 | |
name: convert js to sgmodule | |
on: | |
push: | |
paths: | |
- 'QuantumultX/Scripts/**' # Trigger on changes in scripts folder | |
pull_request: | |
paths: | |
- 'Surge/Sgmodule/**' # Trigger on changes in surge folder | |
workflow_dispatch: | |
jobs: | |
generate_sgmodule: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install PyGithub | |
- name: Run script | |
run: python .github/scripts/convert_js_to_sgmodule.py | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sgmodule-artifacts | |
path: ${{ github.workspace }}/Surge/Sgmodule | |
- name: Push to Quantumult-X Repository | |
run: | | |
set -x | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
git add . | |
git commit -m "已转换为sgmodule文件" | |
git push origin HEAD:main --force | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} |