Overview
I had the opportunity to use custom permissions in a Drupal custom module, so here are my notes.
Background
In the following article, I introduced a module that executes GitHub Actions from Drupal.
However, the permission was set to administer site configuration, so only users with administrator privileges could execute it.
The commit addressing this issue is as follows.
Method
Below, I share the response from ChatGPT 4o.
In Drupal’s _permission, you can set values to configure specific access permissions. This controls whether users with specific roles can access that route.
The main values that can be set for _permission are as follows:
Common Permissions
Drupal provides several standard permissions. Here are examples of commonly used permissions:
administer site configuration- Permission to manage site-wide configurationaccess content- Permission to access contentadminister users- Permission to manage userscreate content- Permission to create contentedit any content- Permission to edit any contentdelete any content- Permission to delete any contentview user profiles- Permission to view user profilesadminister permissions- Permission to manage permissionsaccess administration pages- Permission to access administration pagesadminister taxonomy- Permission to manage taxonomy
Custom Permissions
You can also create module-specific permissions. For example, you can create custom permissions for the github_webhook module and use them in _permission.
To create custom permissions, define them in github_webhook.permissions.yml as follows:
Then, set this custom permission in routing.yml:
Summary
For _permission, you can set standard Drupal permissions (such as administer site configuration). You can also define custom permissions and create access permissions specific to that module or feature.
Configuration
As a result, the following permissions were added, allowing access to be granted for specific roles.

Summary
I hope this serves as a useful reference for building and using Drupal custom modules.