Skip to content

Commit 6253e60

Browse files
author
Mokhlesur Mahin
committed
update: readme
1 parent 489e12a commit 6253e60

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Development of this action is still ongoing, with plans to introduce more featur
88

99

1010
## Usage
11+
12+
### Step: 1
1113
The `github-action-by-permission` action is designed to enforce Role-Based Access Control (RBAC) for manually triggered (`workflow_dispatch`) GitHub workflows. Here's a simple example of how to use this action to control who can trigger a specific workflow:
1214

1315
```yml
@@ -31,26 +33,29 @@ jobs:
3133
- name: Echo Something
3234
run: echo "Hello World!"
3335
```
36+
### Step: 2
37+
Create a yml file mentioning the specific users with their username for the pipeline permission. The file format should be as followed_
38+
39+
```yml
40+
allowed_users:
41+
- username1
42+
- username2
43+
- username3
44+
```
45+
`Note`: *In general, this `permissions.yaml` file should be kept in the root directory of the project*.
3446

3547
### Explanation
36-
**Checkout Code**: The first step checks out the repository code using the standard actions/checkout@v3 action.
48+
**Checkout Code**: The first step checks out the repository code using the standard `actions/checkout@v3` action.
3749

38-
**Check Permissions**: The `github-action-by-permission` action is then used to verify if the user who initiated the workflow has permission to do so. It references a yml file (in this case, named user-permissions.yml) where allowed users are defined.
50+
**Check Permissions**: The `github-action-by-permission` action is then used to verify if the user who initiated the workflow has permission to do so. It references a `yml` file (*in this case, named user-permissions.yml*) where allowed users are defined.
3951

4052
**Echo Something**: If the permission check passes, the workflow proceeds to execute subsequent steps, such as echoing "Hello World!" in this example. You can specify your workflows as needed.
4153

4254
### Key Points
4355
**permissions-file**: This input points to the YAML file that contains the list of users authorized to trigger the workflow. Only those listed in this file will be able to execute the pipeline.
4456

45-
`Note`: *In general, this `permissions.yaml` file is kept in the root directory of the project*.
46-
The structure of this file is as below:
57+
`Note Again`: *In general, this `permissions.yaml` file should be kept in the root directory of the project*.
4758

48-
```yml
49-
allowed_users:
50-
- user1
51-
- user2
52-
- user3
53-
```
5459

5560
**Security and Control**: By integrating this action into your workflows, you can ensure that only authorized individuals have the ability to initiate critical processes, adding a layer of security and control to your CI/CD pipelines.
5661

0 commit comments

Comments
 (0)