github - Github 对有效的现有工作说“等待状态报告”
问题描述
我有一个 PR,我希望在合并到 master 之前完成某项检查。这是工作 https://github.com/hhimanshu/typescript-serverless-api-vercel/actions/runs/763599870
现在,在 PR 中,它的状态没有被报告。这里是公关
https://github.com/hhimanshu/typescript-serverless-api-vercel/pull/4
我查看了过去在https://github.community/t/expected-waiting-for-status-to-be-reported/18001提出的类似问题,但是,该问题中出现此问题的原因是
在大多数情况下,这是因为您从工作流中删除了作业或更改了作业(重命名),但没有更新分支规则。
但在我的情况下,作业名称相同,并且作业也没有被删除,因此该解决方案不适用。
有人可以帮我理解我在这里做错了什么吗?
解决方案
我需要的是一种status
使用 Github REST API 进行更新的方法。
# We must set the commit status manually
# Reference: https://github.com/bahmutov/eleventy-example/blob/main/.github/workflows/ci.yml#L27
- name: Staging Tests ✅
if: ${{ success() }}
# set the merge commit status check
# using GitHub REST API
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "Staging Tests",
"state": "success",
"description": "Staging tests passed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
- name: Staging Tests
if: ${{ failure() }}
# set the merge commit status check
# using GitHub REST API
# see https://docs.github.com/en/rest/reference/repos#create-a-commit-status
run: |
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"context": "Staging Tests",
"state": "failure",
"description": "Staging tests failed",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}'
之后,PR 在支票中显示链接。链接是https://github.com/hhimanshu/typescript-serverless-api-vercel/pull/4
我从https://github.com/bahmutov/eleventy-example/blob/main/.github/workflows/ci.yml#L27了解到这一点,同时使用https://glebbahmutov.com/blog/develop -预览测试/
在此之后,我看到状态正在按预期更新,并带有一个链接,可将我带到工作
我希望这对其他人也有帮助
推荐阅读
- java - LDAP 条目中毒已在 jdk-8u191 中修复?
- java - 按标签和属性过滤 gremlin 路径
- r - R 相当于 python 中的 string.replace()
- command-prompt - 删除临时/隐藏文件
- angular - Receive Payload post in Angular 4+
- r - R Calculate sample weights and weighted aggregation based on reference table
- google-chrome-extension - Chrome extension webrequest api not intercepting mailto or any other non http urls
- design-patterns - What is delegation in julia?
- objective-c - confused by substring result of stringByDeletingLastPathComponent
- ubuntu - 字体在 Ubuntu 18.04 上是粗体,但在 18.10 上不是