You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .claude/CLAUDE.md
+31-2Lines changed: 31 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
-
# GitHub Copilot Instructions for Bitwarden GitHub Actions
1
+
# Bitwarden GitHub Actions - Claude Code Configuration
2
2
3
3
## Repository Overview
4
4
5
5
This repository contains a collection of custom GitHub Actions used by Bitwarden to simplify and standardize CI/CD pipelines across their projects. The repository follows a modular structure where each action is self-contained in its own directory with its own `action.yml` file.
6
6
7
7
**Repository Details:**
8
+
8
9
-**Type**: GitHub Actions collection
9
10
-**Size**: Medium-sized repository with ~20 custom actions
- Use `@actions/core` for GitHub Actions integration
155
176
-`tsconfig.json` for TypeScript configuration
156
177
157
178
**Python Actions:**
179
+
158
180
- Main script typically named `main.py`
159
181
- Use environment variables for input (`os.getenv("INPUT_*")`)
160
182
- Docker-based execution via `Dockerfile`
161
183
162
184
**Testing:**
185
+
163
186
- Test workflows named `test-[action-name].yml`
164
187
- Test fixtures in `tests/fixtures/` subdirectories
165
188
- Tests validate action outputs and side effects
@@ -169,23 +192,27 @@ For containerized actions (e.g., `version-bump`, `get-checksum`):
169
192
All code changes and action development must follow security best practices relevant to GitHub Actions and Bitwarden's standards:
170
193
171
194
**GitHub Actions Security:**
195
+
172
196
-**No hard-coded secrets or credentials** - Use secure parameter passing
173
197
-**Validate all action inputs** - Sanitize and validate user-provided inputs to prevent injection attacks
174
198
-**Use pinned action versions** - All external actions must be pinned to specific commit hashes (enforced by workflow linter)
175
199
-**Minimize permissions** - Use least privilege principle for `permissions` in workflows
176
200
-**Secure output handling** - Avoid exposing sensitive data in action outputs or logs
177
201
178
202
**Secret and Credential Management:**
203
+
179
204
- Use Azure Key Vault integration properly via `get-keyvault-secrets` action
180
205
- Never log or expose secret values in action outputs
181
206
- Use GitHub's secret masking capabilities (`core.setSecret()` in TypeScript actions)
182
207
183
208
**Supply Chain Security:**
209
+
184
210
- Only use approved actions listed in the workflow linter's approved actions list
185
211
- Pin all dependencies to specific versions in `package.json` and `requirements.txt`
186
212
- Validate Docker base images and use official, minimal images when possible
187
213
188
214
**Input Validation:**
215
+
189
216
- Validate file paths to prevent directory traversal attacks
190
217
- Sanitize version strings and other user inputs
191
218
- Use proper escaping when constructing shell commands
@@ -195,6 +222,7 @@ All code changes and action development must follow security best practices rele
195
222
**Trust these instructions** and only perform additional searching if the information provided is incomplete or found to be incorrect. The repository follows consistent patterns, and the validation processes are well-established.
196
223
197
224
**When making changes:**
225
+
198
226
1. Always format code with Prettier before committing
199
227
2. For TypeScript actions, always compile and commit the `lib/` output
200
228
3. Test changes using the existing test workflows when possible
@@ -203,6 +231,7 @@ All code changes and action development must follow security best practices rele
203
231
6. Apply security best practices and validate all inputs
204
232
205
233
**Common pitfalls to avoid:**
234
+
206
235
- Forgetting to compile TypeScript actions
207
236
- Not running Prettier formatting
208
237
- Missing required properties in `action.yml` files
This directory contains Claude Code configuration files for the gh-actions repository.
4
+
5
+
## Directory Structure
6
+
7
+
```
8
+
.claude/
9
+
├── CLAUDE.md # General project context and guidelines
10
+
├── commands/ # Custom slash commands
11
+
│ └── review-pr.md # /review-pr command for PR reviews
12
+
└── prompts/ # Workflow-specific prompts
13
+
└── review-code.md # Used by review-code.yml workflow
14
+
```
15
+
16
+
## Custom Commands
17
+
18
+
### `/review-pr` - Pull Request Review
19
+
20
+
Triggers a comprehensive PR code review in your current Claude Code session.
21
+
22
+
**Usage:**
23
+
24
+
1. Open Claude Code in this repository
25
+
2. Check out the PR branch you want to review
26
+
3. Tag @claude and type `/review-pr`
27
+
28
+
**What it does:**
29
+
30
+
- Analyzes code quality and best practices
31
+
- Checks for security vulnerabilities
32
+
- Validates workflow linter compliance
33
+
- Reviews performance and efficiency
34
+
- Provides structured feedback with action items
35
+
36
+
**Example:**
37
+
38
+
```
39
+
@claude /review-pr
40
+
```
41
+
42
+
## Automated Workflow Reviews
43
+
44
+
The `review-code.yml` workflow uses the `.claude/prompts/review-code.md` to automatically review PRs via GitHub Actions in each Bitwarden repo. The `review-code.md` is used as a gate to execute the `review-code.yml` workflow. Repos without this file will not see Claude code reviews performed on each pull request.
45
+
46
+
**How it works:**
47
+
48
+
1. Workflow triggers on non-draft PRs
49
+
2. Reads `.claude/prompts/review-code.md` from the PR's branch
50
+
3. Posts review as a sticky comment
51
+
4. Updates comment on new commits
52
+
53
+
**To enable in our repos:**
54
+
55
+
1. Create `.claude/prompts/review-code.md` with review criteria
56
+
2. Workflow runs automatically on subsequent pull requests
57
+
58
+
## Best Practices
59
+
60
+
-**Commands** (`.claude/commands/`): For interactive Claude Code sessions
61
+
-**Prompts** (`.claude/prompts/`): For automated GitHub Actions workflows
62
+
-**CLAUDE.md**: General project context available in all Claude interactions
Note: The PR branch is already checked out in the current working directory.
8
+
9
+
Provide a comprehensive review including:
10
+
- Summary of changes since last review
11
+
- Critical issues found (be thorough)
12
+
- Suggested improvements (be thorough)
13
+
- Good practices observed (be concise - list only the most notable items without elaboration)
14
+
- Action items for the author
15
+
- Leverage collapsible <details> sections where appropriate for lengthy explanations or code snippets to enhance human readability
16
+
17
+
When reviewing subsequent commits:
18
+
- Track status of previously identified issues (fixed/unfixed/reopened)
19
+
- Identify NEW problems introduced since last review
20
+
- Note if fixes introduced new issues
21
+
22
+
IMPORTANT: Be comprehensive about issues and improvements. For good practices, be brief - just note what was done well without explaining why or praising excessively.
0 commit comments