Giter VIP home page Giter VIP logo

notion-github-action's Introduction

Notion x GitHub Action

Code Style: Google

Connect your GitHub issues to a Notion database.

Like this GitHub Action? Give us a ⭐️ and follow us on Twitter for more drops πŸͺ‚.


Quick Start

  1. Create a new internal Notion integration and note the value of the Internal Integration Token.
  2. In your GitHub repository, go to Settings > Secrets, and add a New repository secret. Set the Name to NOTION_TOKEN and the Value to the Internal Integration Token you created in the previous step.
  3. Set up your Notion Database. Use this template and duplicate it to your workspace. Screen Shot 2021-06-14 at 11 37 51 AM
  4. In your Notion Database page's Share menu, add the Notion integration you created as a member with the Can edit privilege. You may have to type your integration's name in the Invite field. Screen Shot 2021-06-14 at 11 41 25 AM
  5. Find the ID of your Database by copying the link to it. The link will have the format
https://www.notion.so/abc?v=123

where abc is the database id.

  1. Add the Database's ID as a repository secret for your GitHub repository. Set the Name to NOTION_DATABASE and the Value to the id of your Database.

  2. In your GitHub repository, create a GitHub workflow file at the path .github/workflows/issues-notion-sync.yml.

name: Notion Sync

on:
  workflow_dispatch:
  issues:
    types:
      [
        opened,
        edited,
        labeled,
        unlabeled,
        assigned,
        unassigned,
        milestoned,
        demilestoned,
        reopened,
        closed,
      ]

jobs:
  notion_job:
    runs-on: ubuntu-latest
    name: Add GitHub Issues to Notion
    steps:
      - name: Add GitHub Issues to Notion
        uses: tryfabric/notion-github-action@v1
        with:
          notion-token: ${{ secrets.NOTION_TOKEN }}
          notion-db: ${{ secrets.NOTION_DATABASE }}
  1. (Optional) If your Github repository has any preexisting issues that you would like to sync to your new Notion Database you can trigger a manual workflow. Make sure your organization's default GITHUB_TOKEN has read and write permissions then follow these intructions to run the Notion Job workflow.

Note: The manual workflow will only work on Notion Databases created from the templated linked above.

Using release-it

  1. Locally, on master (make sure it's up to date), execute GITHUB_TOKEN=<TOKEN> release-it. (Alternatively, set GITHUB_TOKEN as a system environment variable)
  2. Follow the interactive prompts, selecting Yes for all options.
  3. When selecting the increment, choose patch when the release is only bug fixes. For new features, choose minor. For major changes, choose major.

Release-It will then automatically generate a GitHub release with the changelog inside.


Built with πŸ’™ by the team behind Fabric.

notion-github-action's People

Contributors

conarro avatar dependabot[bot] avatar endbug avatar github-actions[bot] avatar jjhartmann avatar marissamarym avatar rr-codes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

notion-github-action's Issues

abc

heading 1

heading 2

heading 3

heading 4


bold italic bold and italic code

block quote 1
block quote 2

some link

  • list item 1
  • list item 2
  1. numbered item 1
  2. numbered item 2
  • checkbox false
  • checkbox true

@rr-codes mention

#17 reference

public class Main {}

'Not Found' error returned when performing initial sync of Issues

Discuss in #public-issue-54--not-found-error-returned-when-performing-initial-sync-of-issues

Describe the bug

When attempting to perform an initial sync of existing Issues in the respective repository, a Not Found error is returned

Steps to reproduce

  1. Follow all steps in guide
  2. Verify that organization and repo token have all required permissions
  3. Manually run workflow_dispatch from Github UI
  4. Job sets up properly
  5. Finding Github Issues... Error: Not Found
  6. Workflow fails

Expected behavior

Workflow completes and syncs Issues to Notion DB

Additional context

Action logs:

Setup

Current runner version: '[2](https://github.com/SensibleWeather/protect/runs/5631848204?check_suite_focus=true#step:1:2).288.1'
Operating System
Virtual Environment
Virtual Environment Provisioner
GITHUB_TOKEN Permissions
  Actions: write
  Checks: write
  Contents: write
  Deployments: write
  Discussions: write
  Issues: write
  Metadata: read
  Packages: write
  Pages: write
  PullRequests: write
  RepositoryProjects: write
  SecurityEvents: write
  Statuses: write
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'instantish/[email protected]'

Run Job

Run instantish/notion-github-action@v1
  with:
    notion-token: ***
    notion-db: ***
context event: workflow_dispatch
context action: __instantish_notion-github-action
payload action: undefined
Starting...
Checking for issues already in the database...
Finding Github Issues...
Error: Not Found

Action does not handle unsynced issues

Discuss in #public-issue-49--action-does-not-handle-unsynched-issues

Is your feature request related to a problem? Please describe.
As of now, if you update a GitHub issue that has not been previously added to the table, the action will not add it to the table, warning you that it cannot find the page. This can happen if the issue has been created before the workflow had been set up, or if for some reason the first workflow run has been unsuccessful

Describe the solution you'd like
If no corresponding issue is found in the database, we can create a new entry with the updated data.

Make it easy to sync all past issues, not just newly created or edited ones

Discuss in #issue-25--make-it-easy-to-sync-all-past-issues-not-just-newly-created-or-edited-

  • What is the current functionality?
    We currently listen to issue-type events from GitHub to add or update issues to the database.

  • What problems are you facing with the current feature?
    When a user first installs this action, it should pull in all their past issues, so they don't have to wait for the issues to populate.

  • What is your idea?
    This might take some more research about how to do this, because we might need the action to detect when it's been run for the first time, so it can pull in past issues. We don't want to go through and try to sync every issue on every issue event.

Sync the body of the GitHub issue to the Notion block content

  • What is the current functionality?
    We don't add the body of the issue to the block content.

  • What problems are you facing with the current feature?
    It would be nice to open up the issue in Notion as a page and see the rich text, so users can get context on the issue faster. However, there are limitations with the Notion API that don't let us update the content of the blocks. We don't want to write to the blocks if we aren't able to update them later, because the issues could become stale.

  • What is your idea?
    When the Notion API lets us update blocks, sync the body of the issue to the content of the block.

Richard Robinson:

As a product manager, if details on an issue change, I want that to reflect in the Notion table so that I don’t have to go to GitHub to check the details

Due to Notion API limitations, all the database pages properties can be updated, however the content within the pages cannot be, as blocks may not be modified.

Marissa: does that mean we can't populate the page with the body? I think that's fine, we can just keep it in the table

Richard Robinson: we can, it just won’t update if the body happens to change

Marissa: ok, if we can't update it, we might not want to set it. we can also record that as an issue to do when that functionality comes out from the API

Richard Robinson: aw ok πŸ‘

Documentation has incorrect repo name

Describe the bug

Action errors out with Unable to resolve actions. Repository not found

Steps to reproduce

Create a workflow with the following job run details:

jobs:
  notion_job:
    runs-on: ubuntu-latest
    name: Add GitHub Issues to Notion
    steps:
      - name: Add GitHub Issues to Notion
        uses: instantish/notion-github-action@v1
        with:
          notion-token: ${{ secrets.NOTION_TOKEN }}
          notion-db: ${{ secrets.NOTION_DATABASE }}

Expected behavior

A completed action.

Additional context

It appears that github actions cannot resolve redirects: https://github.com/orgs/community/discussions/25727

It looks like the documentation should be updated to reflect the actual (updated?) org name.

thank you!

When an issue has unsupported markdown, manual workflow fails

Describe the bug

Using the manual workflow, if an issue hase unsupported markdown, the whole workflow fails.

Steps to reproduce

  1. Create an issue with supported markdown
  2. Create another issue with unsupported markdown
  3. Launch a manual workflow

Expected behavior

The job should synchronize all issues. Issues with unsupported markdown should have an empty body or an explicit error as a body.

Additional context

No response

Fill item body with parsed blocks instead of rich text

Is your feature improvement related to a problem? Please describe.

As of now, the only child of each database entry is a paragraph with the rich text parsed from the issue. This makes the body redundant since it displays the exact same text as the Body column of the database.

Describe the solution you'd like

We could actually parse blocks from the issue body: this would result in a more accurate result.
We could also use this when there are unsupported elements that cannot be converted to rich text but can be shown as blocks: we can just fill the children and then write a note in the Body property.

Describe alternatives you've considered

No response

Additional context

No response

Sync fails if GitHub Issue has an empty `body`

Discuss in #issue-31--sync-fails-if-github-issue-has-an-empty-body

Describe the bug
When parsing the issue body in the removeHTML function, an exception is raised if the issue body is empty: Cannot read property 'replace' of null

To Reproduce
Steps to reproduce the behavior:

  1. Create an issue with no body (in a repo with the action wired up)
  2. The action will fail and the issue will not be synced to Notion

Expected behavior
The issue is pushed to Notion with the body field empty

Screenshots
image

hello test

heading 1

heading 2

heading 3

heading 4


bold italic bold and italic code

block quote 1
block quote 2

some link

  • list item 1
  • list item 2
  1. numbered item 1
  2. numbered item 2
  • checkbox false
  • checkbox true

@rr-codes mention

#17 reference

public class Main {}

Error when Milestone is Empty

Discuss in #public-issue-51--error-when-milestone-is-empty

Describe the bug
When an issue is created that does not contain milestones this error occurs:

Run instantish/[email protected]
context event: issues
context action: __instantish_notion-github-action
payload action: closed
Starting...
Querying database for page with github id xxx
Query successful: Page xxx
Updating page for issue #62
Client warn: request fail {
  code: 'validation_error',
  message: 'body failed validation: body.properties.Milestone.rich_text[0].text.content should be populated, instead was `""`.'
}
Error: body failed validation: body.properties.Milestone.rich_text[0].text.content should be populated, instead was `""`.

To Reproduce
Steps to reproduce the behavior:

  1. Use this config:
name: Notion Sync

on:
  workflow_dispatch:
  issues:
    types:
      [
        opened,
        edited,
        labeled,
        unlabeled,
        assigned,
        unassigned,
        milestoned,
        demilestoned,
        reopened,
        closed,
      ]

jobs:
  notion_job:
    runs-on: ubuntu-latest
    name: Add GitHub Issues to Notion
    steps:
      - name: Add GitHub Issues to Notion
        uses: instantish/[email protected]
        with:
          notion-token: ${{ secrets.NOTION_TOKEN }}
          notion-db: ${{ secrets.NOTION_DATABASE }}
  1. Create an Issue without assigning a milestone.

Add project / project column properties to database pages

Discuss in #public-issue-22--add-project--project-column-properties-to-database-pages

  • What is the current functionality?

We don't show the project and project column, if any, this issue belongs to.

  • What problems are you facing with the current feature?

Not knowing about the corresponding project

  • What is your idea?

Adding two properties to the database to correspond to the project and project column.

Doing so requires the github token as the issue payload does not contain any project information, so we would have to query github for the information.

Write README

Created in #feed-notion-github-action

  • What is the current functionality?
    No README yet for using and contributing

  • What problems are you facing with the current feature?
    Need to round out with a README like the Memorable Milestones GitHub Action

Add a `closed at` property

  • What is the current functionality?
    We just show created at and updated at on the database table.

  • What problems are you facing with the current feature?
    Since we have the status updating, it might be nice to see when that issue was closed. This could also possibly enable a Notion timeline view where we see how long issues were open for.

  • What is your idea?
    Add a closed at property to the table

test425

Discuss in #issue-15--test425

heading 1

heading 2

heading 3

underscore

emphasis

crossedout

  • bullet point 1
  • bullet point 2
  1. number 1
  2. number 2
  • checkbox 1
  • checkbox 2

quote

public class Point {}

Double issues

Describe the bug

Issues are being added double into my database

Steps to reproduce

Create new issue through github with a description, 2 labels & assignee.

Expected behavior

It is creating 2 cards into notion

Additional context

No response

Use the default value for the GitHub token

Discuss in #public-issue-44--using-the-default-value-for-the-github-token

As of now, the user is required to pass the GitHub token to the action through the github-token input.
Unless they have restricted the access of the default GITHUB_TOKEN in such a way that doesn't allow it to access issues, this value will almost always be the secrets.GITHUB_TOKEN.

We could set this value to be the default token inside the action manifest so that the vast majority of users can avoid using this input.
Of course, if they have to use a custom PAT they can always use the input as usual. The docs would need to say that there's this input, but it's only intended to be changed for who needs to use a custom PAT...

What do you think about it? Should I open a PR?

Unsupported markdown element

Describe the bug

Workflow failing for some reason

Steps to reproduce

First thought was that it's failing because of image.

It's failing with both - html and plain MD syntax:

Error: Unsupported markdown element: {"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"text","value":"Clarification and motivation","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":31,"offset":30}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":31,"offset":30}}},{"type":"paragraph","children":[{"type":"text","value":"Users could upload a big photo, which is great, but we have a lot of different photo formats (e.g Avatar on the profile page, card on the main page, etc) so it will be cool to have at least formats and resizes like such:","position":{"start":{"line":3,"column":1,"offset":34},"end":{"line":3,"column":221,"offset":254}}}],"position":{"start":{"line":3,"column":1,"offset":34},"end":{"line":3,"column":221,"offset":254}}},{"type":"html","value":"<img width=\"330\" alt=\"image\" src=\"[https://user-images.githubusercontent.com/20303265/231201080-8852cd38-3877-4c9a-a410-ac35631e0864.png\](https://user-images.githubusercontent.com/20303265/231201080-8852cd38-3877-4c9a-a410-ac35631e0864.png/)">","position":{"start":{"line":5,"column":1,"offset":258},"end":{"line":5,"column":138,"offset":395}}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Acceptance criteria","position":{"start":{"line":8,"column":3,"offset":403},"end":{"line":8,"column":22,"offset":422}}}],"position":{"start":{"line":8,"column":1,"offset":401},"end":{"line":8,"column":22,"offset":422}}},{"type":"paragraph","children":[{"type":"text","value":"When accessed with API model with photo should return different sizes.","position":{"start":{"line":10,"column":1,"offset":426},"end":{"line":10,"column":71,"offset":496}}}],"position":{"start":{"line":10,"column":1,"offset":426},"end":{"line":10,"column":71,"offset":496}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":11,"column":1,"offset":498}}}
Error: Unsupported markdown element: {"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"text","value":"Clarification and motivation","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":31,"offset":30}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":31,"offset":30}}},{"type":"paragraph","children":[{"type":"text","value":"Users could upload a big photo, which is great, but we have a lot of different photo formats (e.g Avatar on the profile page, card on the main page, etc) so it will be cool to have at least formats and resizes like such:","position":{"start":{"line":3,"column":1,"offset":34},"end":{"line":3,"column":221,"offset":254}}}],"position":{"start":{"line":3,"column":1,"offset":34},"end":{"line":3,"column":221,"offset":254}}},{"type":"paragraph","children":[{"type":"image","title":null,"url":"https://user-images.githubusercontent.com/20303265/231201080-8852cd38-3877-4c9a-a410-ac35631e0864.png","alt":"Example","position":{"start":{"line":5,"column":1,"offset":258},"end":{"line":5,"column":114,"offset":371}}}],"position":{"start":{"line":5,"column":1,"offset":258},"end":{"line":5,"column":114,"offset":371}}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Acceptance criteria","position":{"start":{"line":8,"column":3,"offset":379},"end":{"line":8,"column":22,"offset":398}}}],"position":{"start":{"line":8,"column":1,"offset":377},"end":{"line":8,"column":22,"offset":398}}},{"type":"paragraph","children":[{"type":"text","value":"When accessed with API model with photo should return different sizes.","position":{"start":{"line":10,"column":1,"offset":402},"end":{"line":10,"column":71,"offset":472}}}],"position":{"start":{"line":10,"column":1,"offset":402},"end":{"line":10,"column":71,"offset":472}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":11,"column":1,"offset":474}}}

But then I've deleted image, and it's still failing

Error: Unsupported markdown element: {"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"text","value":"Clarification and motivation","position":{"start":{"line":1,"column":4,"offset":3},"end":{"line":1,"column":32,"offset":31}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":32,"offset":31}}},{"type":"paragraph","children":[{"type":"text","value":"Users could upload a big photo, which is great, but we have a lot of different photo formats (e.g Avatar on the profile page, card on the main page, etc) so it will be cool to have at least formats and resizes.","position":{"start":{"line":3,"column":1,"offset":35},"end":{"line":3,"column":211,"offset":245}}}],"position":{"start":{"line":3,"column":1,"offset":35},"end":{"line":3,"column":211,"offset":245}}},{"type":"heading","depth":1,"children":[{"type":"text","value":"Acceptance criteria","position":{"start":{"line":5,"column":4,"offset":252},"end":{"line":5,"column":23,"offset":271}}}],"position":{"start":{"line":5,"column":1,"offset":249},"end":{"line":5,"column":23,"offset":271}}},{"type":"paragraph","children":[{"type":"text","value":"When accessed with API model with photo should return different sizes.","position":{"start":{"line":7,"column":1,"offset":275},"end":{"line":7,"column":71,"offset":345}}}],"position":{"start":{"line":7,"column":1,"offset":275},"end":{"line":7,"column":71,"offset":345}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":8,"column":1,"offset":347}}}

What is a problem?
Here is my issue body (without image):

# Clarification and motivation

Users could upload a big photo, which is great, but we have a lot of different photo formats (e.g Avatar on the profile page, card on the main page, etc) so it will be cool to have at least formats and resizes.

# Acceptance criteria

When accessed with API model with photo should return different sizes.

Expected behavior

Issue should be synced with notion

Additional context

No response

Update README to use latest release

EDIT: all of this is irelevant as I used a previous release.

Describe the bug

When a user launch a manual workflow after the setup, an unexplicit error happen

Steps to reproduce

Follow the steps described in the README.
Launch a manual workflow.

Expected behavior

Issues should be synchronized.

Additional context

Run instantish/[email protected]
  with:
    notion-token: ***
    notion-db: ***
context event: workflow_dispatch
context action: __instantish_notion-github-action
payload action: undefined
Starting...
Checking for issues already in the database...
Error: Cannot read property 'number' of undefined

Release v.1.2.4

Is your feature request related to a problem? Please describe.

Just installed this on my notion/repo and ran into the issue fixed in #56 along with another one where it would fail if the body of the GH issue is blank. Closest issue I could find was #62 but I can't confirm if that's exactly related.

Describe the solution you'd like

Just cut another release at the current state to protect against the aforementioned issue. I don't mind making sure I have a body on my issues, but not being able to use MD to write them is not ideal.

Describe alternatives you've considered

No response

Additional context

Screenshot 2022-10-04 at 10 08 07

Screenshot 2022-10-04 at 10 08 20

Error: Cannot read property 'type' of undefined

Describe the bug

Using tryfabric/[email protected], creating a new GH issue fails to sync to Notion via the workflow action.

Steps to reproduce

  1. Follow the setup
  2. Create a new issue
  3. Check the failed action

Expected behavior

A new Notion page created for the GH issue.

Additional context

This recently started failing. I upgraded to tryfabric/[email protected] but it's still failing. Any sense for what might be going on? Thanks. :)

Screen Shot 2022-07-20 at 1 27 29 PM

hhh

header

this ia italics ffff

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.