Skip to content

Integrate GitHub API to Export Snippets as Gists #16

Description

@kp348

⚠️ Competition Only
This issue was created exclusively for participants of SourceSprint'26, an open-source competition held at VIT Vellore.
Pull requests submitted for this issue will only be accepted from registered SourceSprint'26 participants. Pull requests from others will be closed without review.

Description

CodeVault is great for local storage, but sometimes developers need to share a snippet with a team or link it in a forum. We should add a "Share to Gist" button on the snippet cards that uses the GitHub REST API to automatically create a secret GitHub Gist containing the snippet's code.

Expected Behavior

  • Add a new button to the .snippet-actions container.
  • When clicked, the app should prompt the user for a GitHub Personal Access Token (PAT) if they haven't provided one yet, and save it in localStorage securely.
  • Use the JavaScript fetch() API to send a POST request to [https://api.github.com/gists](https://api.github.com/gists) with the snippet's title and code.
  • Upon success, change the button text to "Gist Created!" and open the new Gist link in a new tab.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions