READMEs, Releases and Repository Hygiene
Document a project with a README and license, mark versions with tags and releases, meet GitHub Actions, and keep secrets out of your history.
Welcome back!
Step 1 of 14Learn
A great project nobody can use
Two developers publish similar tools for converting spreadsheets to JSON. The first repository's page shows a list of files and nothing else. The second shows a page that explains what the tool does in one sentence, how to install it, a three-line usage example, a screenshot of the output and a license. Within a year, the second has hundreds of users and contributors. The first has none. The code quality was about the same.
The page GitHub displays below the file list is the repository's README, a file named README.md in the root folder. It's the front door of your project, for strangers, for teammates and for you six months from now.
A useful README answers, in roughly this order:
- What is this, in one or two sentences?
- How do I install or set it up?
- How do I use it? Show a minimal example.
- How do I run the tests or contribute?
- What's the license, and who maintains it?
The .md extension means Markdown, a plain-text format that GitHub renders as formatted text. You already know most of it from this course: # for headings, **bold**, backticks for code, and dashes for lists.
Step 2 of 14Learn
Other files GitHub understands
Beyond the README, a few conventional files make a repository easier to use and contribute to. GitHub recognizes them and links them in the interface:
- LICENSE states what others may do with your code. Without a license, default copyright applies, which means others have no permission to use, modify or share it, even if the repository is public. Common choices are MIT (very permissive), Apache 2.0 (permissive, with patent terms) and GPL (requires derivative works to stay open source). GitHub can add one when you create a repository.
- CONTRIBUTING.md explains how to propose changes: branch naming, tests to run, code style.
- CODE_OF_CONDUCT.md sets expectations for behavior in the community.
- SECURITY.md tells people how to report vulnerabilities privately instead of in a public issue.
- .github/ holds GitHub-specific configuration: issue and PR templates, CODEOWNERS and workflow files for automation.
- CHANGELOG.md records notable changes in each version, newest first.
You don't need all of these on day one. A README, a license and a .gitignore cover a personal project. Add the others when people outside your immediate team start contributing.
Step 3 of 14Diagram
A repository people can use
Tap a shape with to see more.
- Healthy repository
- README.md
What it is, how to install, a quick example.
- LICENSE
What others may legally do with the code.
- CONTRIBUTING.md
How to propose changes.
- CODE_OF_CONDUCT.md
Expected behavior in the community.
- SECURITY.md
How to report vulnerabilities privately.
- .gitignore
Keeps junk and secrets out.
Step 4 of 14Practice · Match the pairs
Match each file to its purpose.
Tap an answer, then tap the place where it belongs (or drag it there).
- README.md
- LICENSE
- CONTRIBUTING.md
- SECURITY.md
- .gitignore
Step 5 of 14Learn
Tags, releases and version numbers
Commit hashes identify every snapshot, but nobody wants to tell a customer "please upgrade to 9f3e2a1." A tag gives a permanent, human-friendly name to one commit:
git tag -a v1.4.0 -m "Version 1.4.0"
git push origin v1.4.0
The -a flag creates an annotated tag, which stores who tagged it, when, and a message; it's the recommended kind for releases. Tags aren't pushed by default, so push them explicitly (or all at once with git push origin --tags). Unlike branches, tags never move.
Many projects number versions with semantic versioning, MAJOR.MINOR.PATCH:
- PATCH (1.4.0 → 1.4.1): bug fixes that don't change how the software is used.
- MINOR (1.4.1 → 1.5.0): new features that are backward compatible. Patch resets to 0.
- MAJOR (1.5.0 → 2.0.0): breaking changes that may require users to change their code. Minor and patch reset to 0.
On GitHub, a release is built on a tag. From the Releases page you can draft release notes (GitHub can generate them from merged PRs), attach downloadable files such as installers, and publish. Users can then watch the repository for new releases.
Step 6 of 14Practice · Diagram
Semantic versioning in practice
A release removes an old function that users call. Which version fits?
Tap the shape that answers the question, then press Check.
- 1.4.0
Starting release.
- 1.4.1: bug fix
PATCH goes up.
- 1.5.0: new feature
MINOR goes up, PATCH resets to 0.
- 2.0.0: breaking change
MAJOR goes up; MINOR and PATCH reset.
Step 7 of 14Practice · Fill in the blanks
Fill in the blanks
A project at version 2.4.1 under semantic versioning ships a release that only fixes bugs. The new version number is . If it instead added a backward-compatible feature, it would be .
Step 8 of 14Learn
Automation with GitHub Actions
Every time someone opens a PR, someone should run the tests, check formatting and maybe build the project. People forget; machines don't. GitHub Actions runs these jobs automatically in the cloud.
You describe a workflow in a YAML file inside .github/workflows/, for example .github/workflows/tests.yml. A simplified workflow looks like this:
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm testIn plain words: on every push and pull request, start a fresh Linux machine, check out the code, install dependencies and run the tests. The result appears on the PR as a status check: a green check or a red cross with a link to the log. Combined with a branch protection rule that requires the check to pass, broken code can't reach main.
The same system handles continuous deployment, such as publishing a website whenever main changes, plus chores like labeling issues or building release files. Workflows can use secrets, such as deployment keys stored in the repository's settings, so credentials never appear in the code. Free plans include a monthly allowance of Actions minutes, and public repositories get generous usage.
Step 9 of 14Diagram
What the Tests workflow does
Tap a shape with to see more.
- Push or PR
on: [push, pull_request]- Fresh Linux VM
runs-on: ubuntu-latest- Check out code
actions/checkout- npm ci
Install exact dependencies.
- npm test
Run the test suite.
- Status check on PR
Green check or red cross.
Step 10 of 14Practice · Choose one
Where does GitHub look for GitHub Actions workflow files in a repository?
Step 11 of 14Learn
Keep secrets out, and know what to do when one gets in
Secrets in Git repositories are one of the most common causes of security incidents. API keys, database passwords, cloud credentials and private keys end up committed because they were in a config file that seemed harmless at the time.
Prevention habits:
- Store secrets in environment variables or a
.envfile that is listed in.gitignorefrom the very first commit. Commit a.env.examplefile with placeholder values so others know which variables to set. - Use your platform's secret storage, such as GitHub Actions secrets, for automation.
- Review
git diff --stagedbefore each commit. It takes five seconds. - Turn on GitHub's secret scanning and push protection, which can detect many known credential formats and block a push that contains one.
- Protect your account with two-factor authentication and keep tokens short-lived and narrowly scoped.
If a secret is committed and pushed, deleting it in a new commit isn't enough; it's still in history and possibly in other people's clones. Revoke or rotate the credential first, immediately. Then check logs for misuse. Removing it from history with a tool like git filter-repo is optional cleanup after that, and requires coordinating a force-push with everyone who has a copy.
Step 12 of 14Note
Step 13 of 14Practice · Select all that apply
Which habits help keep secrets out of a repository? Select all that apply.
Select all that apply.
Step 14 of 14Practice · What would you do?
What would you do?
You realize that a commit you pushed to a public GitHub repository an hour ago includes config.js with a live payment API key. What do you do first?
Lesson complete!