GITHUB_TOKEN permissions

Start with the smallest token permission

Lesson 9 of 20 · 12 min · Module 3: Dependencies, coverage, and access

A job that only reads source should not receive repository write privileges.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Name the action that needs access
  • Set a restrictive default

The idea

A workflow combines an event boundary, job dependencies, and ordered steps. Conditions and prerequisite outcomes determine which jobs can run.

01Name the action that needs access

Reading repository source requires a different capability from publishing a release. Decide access from the job responsibility.

02Set a restrictive default

An explicit contents: read default documents the normal boundary. A future publishing job can request its narrower additional access separately.

03Review overrides too

Job-level permissions can change the boundary. Inspect the complete workflow rather than assuming the root permissions cover every job.

Your turn

Use testJob behavior: checkout and npm test. Set workflow permissions to contents: read, with no write permissions anywhere.

What the checks look for

  • Defaults to read-only contents
  • Has no write-valued permission
Try it in the editor →

Take this with you

Grant capabilities to a responsibility rather than to an entire pipeline by habit.

Go a little further

Identify the additional permission a package-publishing job would need.

Learn CI/CD & Release Engineering for free

20 short lessons with real code and instant checks.

See the whole course →