Workflow Permissions
100%

Continuous Integration · Lesson 7

Workflow Permissions

Learn to give a routine CI check only the repository access it needs.

A CI job can run commands and may also receive credentials. A permission sets what those credentials may read or change. A job that only checks the page usually needs to read source files.

Giving a Check Read Access

This GitHub Actions excerpt limits the workflow's built-in token to read access for repository contents.

permissions:
  contents: read

The checkout and local test can read the repository. A job that publishes a package needs access to a different action on a different resource. Give publishing access to the specific job that needs it.

A job reads the page and runs grep. Which repository content permission fits?

Handling Sensitive Values

A secret is a value such as a private token. Use the platform's secret storage when an approved job needs one. Keep ordinary page settings separate from secrets. Routine checks against a local sample should work without publishing credentials.

Which value belongs in controlled secret storage?

Keeping Logs Useful

Workflow logs can be shared with other people. Report the action and its result without printing secret values. A failure can say that a required credential was unavailable or that access was denied. Give a maintainer the job name and revision to investigate. Keep the credential's value out of the message.

A publish job cannot authenticate. Which log message helps a reviewer without exposing the credential?

Reviewing a New Job

A proposed workflow runs page checks on pull requests and adds a package publisher. The two jobs need different access. Keep the check's read permission narrow and grant any approved publishing permission only where the workflow actually publishes.

Which revision of the proposal best matches the two jobs' needs?

Lesson complete

You finished Workflow Permissions

You can now reason about access for a small CI pipeline.

  • Match repository permissions to the work a job needs.

  • Store private credentials through controlled inputs.

  • Record useful errors while protecting credential values.

Keep your learning progress

Create a free account to save this lesson and continue learning on any device.

Create a free account
Back to Continuous Integration