Skip to content

Commit fb5baec

Browse files
authored
Merge pull request #38 from GrantBirki/guide
Usage Guide
2 parents 1c1a18a + 4a09eef commit fb5baec

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ on:
7777
permissions:
7878
pull-requests: write
7979
deployments: write
80-
contents: read
80+
contents: write
8181

8282
jobs:
8383
demo:
@@ -172,9 +172,9 @@ It is important to note that the workflow we want to run IssueOps on is `issue_c
172172
```yaml
173173
# Permissions needed for reacting and adding comments for IssueOps commands
174174
permissions:
175-
pull-requests: write
176-
deployments: write
177-
contents: read
175+
pull-requests: write # Required for commenting on PRs
176+
deployments: write # Required for updating deployment statuses
177+
contents: write # Required for reading/writing the lock file
178178
```
179179

180180
These are the minimum permissions you need to run this Action

docs/usage.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Branch Deploy Usage Guide 📚
2+
3+
This document is a quick guide / cheatsheet for using the `branch-deploy` Action
4+
5+
> This guide assumes default configuration options
6+
7+
## Deployment 🚀
8+
9+
Deployments respect your repository's branch protection settings. You can trigger either a regular or noop deployment:
10+
11+
- `.deploy` - Triggers a regular deployment
12+
- `.deploy noop` - Triggers a noop deployment (think Terraform plan for example)
13+
14+
## Deployment Locks 🔒
15+
16+
If you need to lock deployments so that only you can trigger them, you can use the following set of commands:
17+
18+
- `.lock` - Locks deployments (sticky) so that only you can trigger them
19+
- `.unlock` - Removes the current deployment lock (if one exists)
20+
- `.lock --info` - Displays info about the current deployment lock if one exists
21+
- `.wcid` - An alias for `.lock --info`, it means "where can I deploy"
22+
23+
## Deployment Permissions 🔑
24+
25+
In order to run any branch deployment commands, you need the following permissions:
26+
27+
- `write` or `admin` permissions to the repository
28+
- You must either be the owner of the current deployment lock, or there must be no deployment lock
29+
30+
## Example Workflow 📑
31+
32+
An example workflow for using this Action might look like this:
33+
34+
1. A user creates an awesome new feature for their website
35+
2. The user creates a branch, commits their changes, and pushes the branch to GitHub
36+
3. The user opens a pull request to the `main` branch from their feature branch
37+
4. Once CI is passing and the user has the proper reviews on their pull request, they can continue
38+
5. The user grabs the deployment lock as they need an hour or two for validating their change -> `.lock`
39+
6. The lock is claimed and now only the user who claimed it can deploy
40+
7. The user runs `.deploy noop` to get a preview of their changes
41+
8. All looks good so the user runs `.deploy` and ships their code to production from their branch
42+
9. After an hour or so, all looks good so they merge their changes to the `main` branch
43+
10. Upon merging, they comment on their merged pull request `.unlock` to remove the lock
44+
11. Done!

0 commit comments

Comments
 (0)