# github/platform-samples: a directory of sample code, organised by documentation guide

> No library and no framework, just eight top level folders of examples for the GitHub API, GraphQL, webhooks, Microsoft Graph, pre-receive hooks, scripts and SQL, released under CC0 with a public invitation to contribute.

**github/platform-samples** — A public place for all platform sample projects.

- Repository: https://github.com/github/platform-samples
- Stars: 2,175 · Forks: 1,871
- Language: Shell
- License: CC0-1.0
- Published: 2026-10-06 · Updated: 2026-10-06 · Language: en
- Canonical page: https://hysenlabs.com/projects/github-platform-samples

## Eight folders, no package to install

The first thing to understand is that nothing here is meant to be consumed as a dependency. The tracked top level entries are:

```text
api/
app/
graphql/
hooks/
microsoft-graph-api/
pre-receive-hooks/
scripts/
sql/
```

Alongside those sit `README.md`, `SUPPORT.md`, `LICENSE.txt`, `.gitignore` and a `.github/` directory. There is no package manifest, no build step and no release list. The repository's language is recorded as Shell, which reflects the shell scripts in the `scripts/` folder rather than anything about the samples as a whole.

The repository description is a public place for all sample projects related to the GitHub Platform, and that is exactly the scope. What you get when you clone it is a set of folders to read, copy lines out of and adapt.

## The directory layout mirrors the documentation

The organising principle is stated once and then followed throughout: the directories are arranged to correspond with the guides published for platform developers. The README still points at developer.github.com for that mapping, which is the old documentation domain name, so anyone following the link today lands on the current docs rather than the guide set the layout was built against.

The eight categories break down like this. `api/` holds sample code for the GitHub REST API, and its own subdirectories are split by language, which makes it the place to look when you want to see how a particular SDK calls a particular endpoint. `graphql/` holds sample GraphQL queries written against the GitHub GraphQL API. `hooks/` holds examples of writing a consumer for GitHub webhooks.

The remaining four are narrower. `microsoft-graph-api/` holds Microsoft Graph commands for integrations with GitHub, and the README names EMU, Enterprise Managed User OIDC authentication for Azure AD and Entra, as the motivating case. `pre-receive-hooks/` holds hooks that can block commits on GitHub Enterprise Server when they fail your requirements. `scripts/` holds repository maintenance scripts for analysing or cleaning up a Git repository. `sql/` holds SQL for custom reporting on GitHub Enterprise Server.

Two of those eight, `pre-receive-hooks/` and `sql/`, only apply to GitHub Enterprise Server, which is worth knowing before you spend time in them.

## Webhooks and GraphQL are the folders worth your time

If you only visit one part of this repository, make it `hooks/`. Webhook consumers are the case where reading a working example beats reading documentation, because the failure modes are about event ordering, payload shape and signature verification rather than about a single API call. The README frames the folder as a way to find out how to write a webhook consumer, and invites more contributions through pull requests.

`graphql/` is the second one. GraphQL queries are read-only in the way a sample matters: a query either returns the fields you asked for or tells you the schema does not have them, so copying a working query is a quick way to learn both the shape of the data and the shape of the errors. The README links to the GitHub GraphQL API documentation for the schema itself.

`api/` is the largest by implication rather than by size. Since its subdirectories are broken up by language, a team that has already chosen its SDK can find their language and read how the endpoint is called there. The README explicitly asks for language samples that are missing and says pull requests will be considered.

The Microsoft Graph folder is the odd one out, being about a Microsoft product rather than a GitHub one. It exists because Enterprise Managed User tenants require GitHub to talk to Azure AD and Entra, and that integration is awkward enough to want a copyable command.

## CC0 licensing and the invitation to contribute

The licence is CC0-1.0, a public domain dedication, and it is the right choice for this project. Sample code exists to be copied, and CC0 removes the question of attribution entirely, which means a line from `hooks/` can end up in a commercial product without a licence header debate. It also means no warranty and no liability, which is normal for this kind of code and worth remembering when you paste something into a production path.

The contribution model is stated per directory rather than once at the top, and it is consistent in tone: the README asks whether you have a language sample for `api/`, whether you have more pre-receive hook examples, and invites pull requests for `hooks/`, `scripts/` and `sql/`. A repository of samples that expects to grow this way has no maintainer gatekeeping to fight, but it also means a sample can be added without much review, so reading before you run is the sensible habit.

There are no tagged releases in the repository, which is consistent with a collection rather than a tool. If you want to know whether a script still works against the current API, the commit history and the open pull requests are where you look, not a version number. The last push to the repository was on 2026-09-10.

## What is missing, and who this is actually for

Two gaps are worth naming. First, the `app/` directory appears in the tracked files but the README never explains what it contains, so a reader has to open it to find out. Second, the README is short and does not say how any sample is expected to be run, which means every example starts with you working out its own prerequisites.

That shapes the audience. This is not a tutorial repository with a guided first project, and it is not something you wire into a build. It suits someone who already knows the platform and needs to see one concrete working call, or someone writing a webhook handler and looking for the shape of the payload handling rather than the concept. A reader who has never used the GitHub API will get more from the documentation guides than from these folders.

The comparison worth making is with the official documentation itself. The guides are organised by task and explain why something works; this repository is organised by directory and shows one way of doing it. Neither replaces the other, and the most useful pattern is to read the guide for the concept, then open the matching folder for the syntax.

## Conclusion

platform-samples is a directory, not a dependency, and the fastest way to use it is to pick one subdirectory and copy from it. The samples are organised to line up with the platform guides, so the `hooks/` and `graphql/` folders are the most likely to save you an afternoon, while `sql/` and `pre-receive-hooks/` are specific to GitHub Enterprise Server and will not apply to a github.com account at all. Check the licence and the target of any single script before you run it in production, then open the pull request the README invites if you have a language sample the `api/` folder is missing.

## FAQ

### What is inside the api directory of github/platform-samples?

Sample code for the GitHub REST API, with subdirectories broken up by language. The README asks for language samples that are missing and says a pull request adding one will be considered.

### Do the samples in this repository apply to github.com or only Enterprise Server?

Both, but not evenly. The `api/`, `graphql/` and `hooks/` examples apply to github.com. The `pre-receive-hooks/` and `sql/` directories target GitHub Enterprise Server, since pre-receive hooks and custom reporting SQL are Enterprise features.

### Can I use this sample code in a commercial project?

Yes. The repository is licensed CC0-1.0, a public domain dedication, so the samples carry no attribution requirement. There is also no warranty, so reading a sample before you run it in a production path is the sensible habit.

### How do I get Microsoft Graph authentication examples for GitHub?

The `microsoft-graph-api/` directory holds Microsoft Graph commands for integrations with GitHub. The README names EMU, Enterprise Managed User OIDC authentication for Azure AD and Entra, as the case those commands are meant to support.

## Sources

- [github/platform-samples on GitHub](https://github.com/github/platform-samples)
- [Issues](https://github.com/github/platform-samples/issues)
- [License: CC0-1.0](https://github.com/github/platform-samples/blob/master/LICENSE)
- [README](https://github.com/github/platform-samples/blob/master/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/github-platform-samples
