healthyregions / SDOHPlace

Landing page and data discovery application for SDOH Place Project.
https://sdohplace.org
GNU General Public License v3.0
1 stars 1 forks source link

feat: switch to GitHub backend for DecapCMS (instead of git-gateway) #360

Closed bodom0015 closed 1 week ago

bodom0015 commented 2 weeks ago

Problem

Users submitting new CMS content are not the author of their own PRs

Fixes #263

Approach

Before: Screenshot 2024-11-06 at 1 16 52 PM

After: Screenshot 2024-11-06 at 1 16 32 PM

How to Test

Using main repository (standard user flow)

These are the steps that a typical user would run to sign in and add/edit CMS content

  1. Navigate to https://deploy-preview-360--cheerful-treacle-913a24.netlify.app/admin/index.html and login to use DecapCMS
    • First time only - You should be prompted to Authorize with the "Netlify CMS" OAuth application on GitHub
  2. First time only - Click Authorize to confirm logging into the DecapCMS system
    • You should be logged into DecapCMS as your GitHub user (see top-right)
  3. At the top, click New Guides to create a new guide
  4. Enter a Title + Author + Body and click Save at the top left
  5. Check the PRs section of the SDOHPlace repository (e.g. https://github.com/healthyregions/SDOHPlace/pulls)
    • You should see a PR that was created by DecapCMS
    • You should see that this PR is created by your GitHub user

Test with Forked Repository (optional dev flow)

This includes extra steps that a developer can do to isolate their testing of the DecapCMS to their own fork

This can make cleanup a little easier if many PRs may need to be created for testing

  1. Fork the https://github.com/healthyregions/SDOHPlace repository
  2. Run DecapCMS backend: npx decap-server
  3. Run the app with default configuration: yarn dev
  4. Navigate to http://localhost:3000/admin/index.html and login to use DecapCMS
    • First time only - You should be prompted to Authorize with the "Netlify CMS" OAuth application on GitHub
  5. First time only - Click Authorize to confirm logging into the DecapCMS system
    • You should be logged into DecapCMS as your GitHub user (see top-right)
  6. Update backend.repo in config.yml to point at your fork of the repository (e.g. bodom0015/SDOHPlace)
  7. Stop and restart the DecapCMS server: npx decap-server
  8. Stop and restart the SDOHPlace application: yarn dev
  9. Navigate once again to http://localhost:3000/admin/index.html and login
    • You should not be prompted to login (it should reuse your existing auth cookie)
  10. On the left side, click Guides to view existing Guides in the CMS system
  11. At the top, click New Guides to create a new guide
  12. Enter a Title + Author + Body and click Save at the top left
  13. Check the PRs section of your forked copy of the repo (e.g. https://github.com/bodom0015/SDOHPlace/pulls)
    • You should see a PR that was created by DecapCMS
    • You should see that this PR is created by your GitHub user
  14. (optional) Delete your fork of this repository, if you don't plan to use it anymore
netlify[bot] commented 2 weeks ago

Deploy Preview for cheerful-treacle-913a24 ready!

Name Link
Latest commit 0f7ed1bf7454fa39f1328d0d8b3e5c44b0490b05
Latest deploy log https://app.netlify.com/sites/cheerful-treacle-913a24/deploys/67337fc8062bf60008dccf34
Deploy Preview https://deploy-preview-360--cheerful-treacle-913a24.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mradamcox commented 1 week ago

In addition to the switch to this backend, I've added a Ruleset that protects the main and publish branches, and this, in combination with basic Github user access roles to this repo, are enough to 1) allow outside collaborators create new draft content, and then 2) only allow certain of our team members to complete the publication process.