Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add waiting deployment status state #52

Merged

Conversation

martincostello
Copy link
Contributor

@martincostello martincostello commented Mar 28, 2022

Adds the waiting value to the CheckRunStatus, DeploymentStatusState, and WorkflowRunStatus enumerations.

Here's an example of the relevant part a webhook payload I received that had this status:

deployment_status payload
{
  "deployment_status": {
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/deployments/534555140/statuses/962858309",
    "id": 962858309,
    "node_id": "DES_kwDOC2Wnd845ZA1F",
    "state": "waiting",
    "creator": {
      "login": "martincostello",
      "id": 1439341,
      "node_id": "MDQ6VXNlcjE0MzkzNDE=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1439341?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/martincostello",
      "html_url": "https://github.com/martincostello",
      "followers_url": "https://api.github.com/users/martincostello/followers",
      "following_url": "https://api.github.com/users/martincostello/following{/other_user}",
      "gists_url": "https://api.github.com/users/martincostello/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/martincostello/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/martincostello/subscriptions",
      "organizations_url": "https://api.github.com/users/martincostello/orgs",
      "repos_url": "https://api.github.com/users/martincostello/repos",
      "events_url": "https://api.github.com/users/martincostello/events{/privacy}",
      "received_events_url": "https://api.github.com/users/martincostello/received_events",
      "type": "User",
      "site_admin": false
    }
}

It looks like the schema in the webhooks repo and the docs are out of sync with the values that users can actually receive as they're missing both in_progress and waiting.

Adds the `waiting` value to the `DeploymentStatusState` enumeration.
Adds the `waiting` value to the `CheckRunStatus` enumeration.
Adds the `waiting` value to the `WorkflowRunStatus` enumeration.
@JamieMagee
Copy link
Contributor

Can I just confirm did you see the waiting value for CheckRunStatus and WorkflowRunStatus enums or are you extrapolating based on the value you received for DeploymentStatusState?

I know the API can be a little out of sync, but things are set to improve in the near future1

Footnotes

  1. https://twitter.com/gr2m/status/1506759527709827072

@martincostello
Copy link
Contributor Author

Yeah, sorry for not being explicit, I did actually get those values.

I fixed the first one based on the exception I got in my app, and then later on I tried to deserialise the webhook again after incorporating the fix and ran into the second enum value missing. Then rinse and repeat with the third enum+commit, at which point I could successfully deserialise the payload into the event.

@martincostello
Copy link
Contributor Author

Here are the relevant bits of the payload:

deployment_status
{
  "deployment_status": {
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/deployments/534555140/statuses/962858309",
    "id": 962858309,
    "node_id": "DES_kwDOC2Wnd845ZA1F",
    "state": "waiting",
    "creator": {
      "login": "martincostello",
      "id": 1439341,
      "node_id": "MDQ6VXNlcjE0MzkzNDE=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1439341?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/martincostello",
      "html_url": "https://github.com/martincostello",
      "followers_url": "https://api.github.com/users/martincostello/followers",
      "following_url": "https://api.github.com/users/martincostello/following{/other_user}",
      "gists_url": "https://api.github.com/users/martincostello/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/martincostello/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/martincostello/subscriptions",
      "organizations_url": "https://api.github.com/users/martincostello/orgs",
      "repos_url": "https://api.github.com/users/martincostello/repos",
      "events_url": "https://api.github.com/users/martincostello/events{/privacy}",
      "received_events_url": "https://api.github.com/users/martincostello/received_events",
      "type": "User",
      "site_admin": false
    },
    "description": "",
    "environment": "production",
    "target_url": "https://github.com/martincostello/SignInWithAppleSample/runs/5717998026?check_suite_focus=true",
    "created_at": "2022-03-28T09:51:28Z",
    "updated_at": "2022-03-28T09:51:28Z",
    "deployment_url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/deployments/534555140",
    "repository_url": "https://api.github.com/repos/martincostello/SignInWithAppleSample",
    "environment_url": "",
    "log_url": "https://github.com/martincostello/SignInWithAppleSample/runs/5717998026?check_suite_focus=true",
    "performed_via_github_app": null
  },
  "deployment": {
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/deployments/534555140",
    "id": 534895272,
    "node_id": "DE_kwDOC2Wnd84f3KoE",
    "task": "deploy",
    "original_environment": "production",
    "environment": "production",
    "description": null,
    "created_at": "2022-03-28T09:51:25Z",
    "updated_at": "2022-03-28T09:51:28Z",
    "statuses_url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/deployments/534555140/statuses",
    "repository_url": "https://api.github.com/repos/martincostello/SignInWithAppleSample",
    "creator": {
      "login": "martincostello",
      "id": 1439341,
      "node_id": "MDQ6VXNlcjE0MzkzNDE=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1439341?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/martincostello",
      "html_url": "https://github.com/martincostello",
      "followers_url": "https://api.github.com/users/martincostello/followers",
      "following_url": "https://api.github.com/users/martincostello/following{/other_user}",
      "gists_url": "https://api.github.com/users/martincostello/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/martincostello/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/martincostello/subscriptions",
      "organizations_url": "https://api.github.com/users/martincostello/orgs",
      "repos_url": "https://api.github.com/users/martincostello/repos",
      "events_url": "https://api.github.com/users/martincostello/events{/privacy}",
      "received_events_url": "https://api.github.com/users/martincostello/received_events",
      "type": "User",
      "site_admin": false
    },
    "sha": "e5c7c92cd83003979af080b811a0c3ab28fbc859",
    "ref": "main",
    "payload": {

    },
    "transient_environment": false,
    "production_environment": false,
    "performed_via_github_app": null
  },
  "check_run": {
    "id": 5717998026,
    "name": "deploy-production",
    "node_id": "CR_kwDOC2Wnd88AAAABVNG5yg",
    "head_sha": "e5c7c92cd83003979af080b811a0c3ab28fbc859",
    "external_id": "e07742bd-189a-5079-918b-43f8b2f94b89",
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/check-runs/5717998026",
    "html_url": "https://github.com/martincostello/SignInWithAppleSample/runs/5717998026?check_suite_focus=true",
    "details_url": "https://github.com/martincostello/SignInWithAppleSample/runs/5717998026?check_suite_focus=true",
    "status": "waiting",
    "conclusion": null,
    "started_at": "2022-03-28T09:51:24Z",
    "completed_at": null
  },
  "workflow": {
    "id": 882579,
    "node_id": "MDg6V29ya2Zsb3c4ODI1Nzk=",
    "name": "build",
    "path": ".github/workflows/build.yml",
    "state": "active",
    "created_at": "2020-03-28T17:33:32.000Z",
    "updated_at": "2020-03-28T17:33:32.000Z",
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/actions/workflows/882579",
    "html_url": "https://github.com/martincostello/SignInWithAppleSample/blob/main/.github/workflows/build.yml",
    "badge_url": "https://github.com/martincostello/SignInWithAppleSample/workflows/build/badge.svg"
  },
  "workflow_run": {
    "id": 2053875102,
    "name": "build",
    "node_id": "WFR_kwLOC2Wnd856RyIc",
    "head_branch": "main",
    "head_sha": "e5c7c92cd83003979af080b811a0c3ab28fbc859",
    "run_number": 341,
    "event": "workflow_dispatch",
    "status": "waiting",
    "conclusion": null,
    "workflow_id": 882579,
    "check_suite_id": 5825661931,
    "check_suite_node_id": "CS_kwDOC2Wnd88AAAABWzyL6w",
    "url": "https://api.github.com/repos/martincostello/SignInWithAppleSample/actions/runs/2051482140",
    "html_url": "https://github.com/martincostello/SignInWithAppleSample/actions/runs/2051482140",
    "pull_requests": [

    ],
    "created_at": "2022-03-28T09:48:06Z",
    "updated_at": "2022-03-28T09:51:28Z",
    "actor": {
      "login": "martincostello",
      "id": 1439341,
      "node_id": "MDQ6VXNlcjE0MzkzNDE=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1439341?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/martincostello",
      "html_url": "https://github.com/martincostello",
      "followers_url": "https://api.github.com/users/martincostello/followers",
      "following_url": "https://api.github.com/users/martincostello/following{/other_user}",
      "gists_url": "https://api.github.com/users/martincostello/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/martincostello/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/martincostello/subscriptions",
      "organizations_url": "https://api.github.com/users/martincostello/orgs",
      "repos_url": "https://api.github.com/users/martincostello/repos",
      "events_url": "https://api.github.com/users/martincostello/events{/privacy}",
      "received_events_url": "https://api.github.com/users/martincostello/received_events",
      "type": "User",
      "site_admin": false
    },
    "run_attempt": 1,
    "run_started_at": "2022-03-28T09:48:06Z",
    "triggering_actor": {
      "login": "martincostello",
      "id": 1439341,
      "node_id": "MDQ6VXNlcjE0MzkzNDE=",
      "avatar_url": "https://avatars.githubusercontent.com/u/1439341?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/martincostello",
      "html_url": "https://github.com/martincostello",
      "followers_url": "https://api.github.com/users/martincostello/followers",
      "following_url": "https://api.github.com/users/martincostello/following{/other_user}",
      "gists_url": "https://api.github.com/users/martincostello/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/martincostello/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/martincostello/subscriptions",
      "organizations_url": "https://api.github.com/users/martincostello/orgs",
      "repos_url": "https://api.github.com/users/martincostello/repos",
      "events_url": "https://api.github.com/users/martincostello/events{/privacy}",
      "received_events_url": "https://api.github.com/users/martincostello/received_events",
      "type": "User",
      "site_admin": false
    }
  },
  "action": "created"
}

@JamieMagee
Copy link
Contributor

Thanks for the confirmation. Let's get this merged!

@JamieMagee JamieMagee merged commit a39fe36 into octokit:main Mar 31, 2022
@martincostello martincostello deleted the add-waiting_deployment_status_state branch March 31, 2022 06:12
wolfy1339 added a commit to octokit/webhooks that referenced this pull request Apr 28, 2022
wolfy1339 added a commit to octokit/webhooks that referenced this pull request Apr 28, 2022
* fix: add `waiting` state to `deployment_status`, `check_run` and `workflow_run` event
Ref: octokit/webhooks.net#52

* fix: add `skipped` to `workflow_run` conclusion
Ref: octokit/webhooks.net#57

* fix: update the `pull_request` property description on `check_run` event
* feat: add `pull_request_review_thread` examples,
The event was recently added to the docs

* feat(GHES): new event: `package`
* feat(GHES): new `pull_request_review_thread` event
* fix(GHES): event description updates
* feat(GHAE): new `pull_request_review_thread` event
* fix(GHAE): description updates
* feat: remove `secret_scanning_alert` from `index.json`

Co-authored-by: Octokit Bot <octokitbot@martynus.net>
Co-authored-by: wolfy1339 <webmaster@wolfy1339.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants