我正在執行一個 github 操作,通過在合并拉取請求時添加 PR 受讓人的姓名來編輯自述檔案。我嘗試設定一個環境變數以在我的 python 代碼中使用,${{github.event.pull_request.assignees}}但在運行示例 PR 合并時出現以下錯誤:
Error: The template is not valid.
.github/workflows/main.yml (Line: 32, Col: 22): A sequence was not expected
這是我當前的代碼:
name: READMEUPDATER
on:
pull_request:
types: [ closed ]
branches: [ main ]
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Edit the README.md
if: |
github.event.pull_request.merged == true
&& contains(github.event.pull_request.labels.*.name, 'workshop')
run: |
python ./scripts/updater.py
git add README.md
git commit -m "Auto update to README.md"
git fetch origin master
git push origin HEAD:master
env:
repo: ${{github.event.pull_request.base.repo.name}}
assignees: ${{github.event.pull_request.assignees}}
uj5u.com熱心網友回復:
我還是設法解決這個問題,這個問題是,它決議它作為一個串列不是一個字串變數的受讓人,所以我只是用這樣的:${{toJson(github.event.pull_request.assigness)}}。它將串列序列化為 json 字串。而且提交部分也缺少git config user.name "xxx".
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/334068.html
