decaporg / decaporg/decap-cms

Support GitHub Deployments when displaying preview URLs

Open
#4,359 2 comments 0 reactions 0 assignees View on GitHub
area: extensions/backends type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

Preview links are not appearing for me because my CI/CD adds github metadata in the canonical location, but the github integration looks elsewhere.

**Describe the bug**

Currently, the Github integration looks at a commit status's contexts for a deploy url. The thing is, the canonical way to specify a deploy url is using environment deployments. So I think the integration should look at the environment deploy first, then fallback to the context target_url. Here's some GraphGL:

```gql
{
repository(name, owner) {
object(oid) {
... on Commit {
deployments(last: 1) {
nodes {
latestStatus {
environmentUrl # LOOK HERE FIRST
}
}
}
status {
contexts {
targetUrl # THEN LOOK HERE
}
}
}
}
}
}
```

**Expected behavior**

I expect the Github integrations that use the canonical location for deploy urls to work with NetlifyCMS.

**Screenshots**

Here's a screenshot of where Github displays such urls in the PR UI. See "View deployment":

Screen Shot 2020-09-24 at 10 20 51 AM

**CMS configuration**

```js
{
publish_mode: 'editorial_workflow',

backend: {
name: 'github',
repo: 'MY/REPO',
branch: 'master',
squash_merges: true,
use_graphql: true,
open_authoring: false,
base_url: 'MYAUTHURL',
auth_endpoint: 'api/auth/request',
cms_label_prefix: 'cms/',
},
}
```

**Additional context**

In the meantime, do you know any workarounds? Thanks!

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start at the GitHub integration's GraphQL lookup for commit-status contexts and compare it with the deployment query shown in the issue. Done means environmentUrl is checked first and targetUrl remains the fallback, with coverage for both response paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, graphql, javascript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.