如何使 pr assignees 成为合适的环境变量?
How to make pr assignees a proper environment variable?
我正在执行 github 操作,在合并拉取请求时通过添加 PR 受让人的名称来编辑 README。我尝试设置一个环境变量以在我的 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}}
我确实设法解决了它,问题是它将它解析为列表而不是分配给受让人变量的字符串,所以我只使用了这个:${{toJson(github.event.pull_request.assigness)}}
。它将列表序列化为 json 字符串。而且提交部分还缺少 git config user.name "xxx"
.
我正在执行 github 操作,在合并拉取请求时通过添加 PR 受让人的名称来编辑 README。我尝试设置一个环境变量以在我的 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}}
我确实设法解决了它,问题是它将它解析为列表而不是分配给受让人变量的字符串,所以我只使用了这个:${{toJson(github.event.pull_request.assigness)}}
。它将列表序列化为 json 字符串。而且提交部分还缺少 git config user.name "xxx"
.