Py学习  »  Git

如何在push上的github页面中执行多行curl命令?

mapri50 • 3 年前 • 425 次点击  

这是我目前的工作流程,github告诉我第8行有错误,但我找不到。

name: restartServer
on: [push]
jobs:
  check-bats-version:
    runs-on: ubuntu-latest
    steps:
      - run: >
        curl --location --request POST 'https://panel.discordbothosting.com/api/client/servers/fd21d417/power' \
          --header 'Accept: application/json' \
          --header 'Content-Type: application/json' \
          --header 'Authorization: Bearer APIKEY' \
          --data-raw '{
            "signal": "restart"
          }'
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/133786
 
425 次点击  
文章 [ 1 ]  |  最新文章 3 年前
jessehouwing
Reply   •   1 楼
jessehouwing    3 年前

替换:

- run: >

与:

- run: |

并将脚本缩进2个空格:

name: restartServer
on: [push]
jobs:
 check-bats-version:
   runs-on: ubuntu-latest
   steps:
     - run: |
         curl --location --request POST 'https://panel.discordbothosting.com/api/client/servers/fd21d417/power' \
           --header 'Accept: application/json' \
           --header 'Content-Type: application/json' \
           --header 'Authorization: Bearer APIKEY' \
           --data-raw '{
             "signal": "restart"
           }'