GitHub表示正在等待报告有效现有作业的状态 [英] Github says "Waiting for status to be reported" for a valid existing job
问题描述
我有一个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中提出的类似问题,然而,该问题中出现此问题的原因是
在大多数情况下,这是因为您已从工作流中删除了作业或更改了作业(已重命名),但没有更新分支规则。
但在我的情况下,作业名称相同,而且作业也未删除,因此解决方案不适用。
我的分支机构保护规则将此作业作为";必需的";谁能帮我弄明白我到底做错了什么?
推荐答案
我需要的是一种使用Github rest API更新status
的方法。
# 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-preview-test/
之后,我看到状态正在按预期更新,并带有指向该职务的链接
我希望这也能帮助其他人
这篇关于GitHub表示正在等待报告有效现有作业的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!