simonw / show-your-workings

Collaborative repository gathering examples of journalists publishing the data and methodology behind their stories
0 stars 0 forks source link

Use issue templates for submissions #2

Open simonw opened 4 years ago

simonw commented 4 years ago

An issue template with example YAML in it, combined with a bot that reports back on if the YAML is valid.

Having a repo owner add a shipit reaction or comment could cause the bot to land the submission.

Modifications could be handled by regular pull requests. It would just be new submissions that would use issues.

simonw commented 4 years ago

This also means the bot that lands the submission can handle assigning it a unique ID and putting it in the correct place in the directory structure.

simonw commented 4 years ago

And the landing bot can bake in the added timestamp.

simonw commented 4 years ago

I put together enough of a proof of concept that I'm convinced this is worth pursuing.

Here's how it's going to work:

  1. The user clicks "new issue" and selects the "New submission" template
  2. That template embeds a YAML block ready for them to fill in the details
  3. When the issue is submitted, or updated, the bot action checks the YAML
  4. It validates the YAML against a schema (probably using Yamale) - if it's invalid it posts an issue comment with the problems.
  5. If it's valid, it posts a comment saying so. Then a repository owner needs to mark the submission as accepted.
  6. Once that happens, the bot processes the submission. It does this by reserving an ID (the next available numeric ID based on existing files in the repo), creating a $ID.yaml file with the content plus extra id: and publish_date: fields.
  7. The bot posts a comment on the issue linking to the new file, then closes the issue.

A separate process can then compile the SQLite database and publish it somewhere with Datasette.

simonw commented 4 years ago

Events I should listen to (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#issue-comment-event-issue_comment)

on:
  issue_comment:
    types: [created]
  issues:
    types: [opened, edited]
simonw commented 4 years ago

Does an event fire when I add a reaction to a comment? I'll try that now and see what happens on https://api.github.com/repos/simonw/show-your-workings/events

simonw commented 4 years ago

Asked about issue reaction triggers here: https://github.community/t/trigger-workflow-on-issue-comment-reaction/119961

simonw commented 4 years ago

The comment the bot posts on the issue when it lands the submission could include the instruction to propose further changes by proposing edits to the file, with a link.