1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161# Quick Setup Guide for Open Source Project
This guide helps you quickly set up your GitHub repository as an open-source project with proper protection rules.
## Step 1: Enable Branch Protection
### Via GitHub Web Interface
1. Go to your repository on GitHub
2. Click **Settings** โ **Branches**
3. Click **Add rule**
4. Branch name: `main` (or `master`)
5. Enable these settings:
```
โ Require a pull request before merging
โ Require approvals: 1
โ Dismiss stale pull request approvals when new commits are pushed
โ Require status checks to pass before merging
โ Require branches to be up to date before merging
โ Select: Secret Scanning, Code Language Check
โ Require conversation resolution before merging
โ Include administrators
โ Do not allow bypassing the above settings
```
6. Click **Create**
### Via GitHub CLI (Alternative)
```bash
gh api repos/:owner/:repo/branches/main/protection \
--method PUT \
--field required_status_checks='{"strict":true,"contexts":["Secret Scanning","Code Language Check"]}' \
--field enforce_admins=true \
--field required_pull_request_reviews='{"required_approving_review_count":1,"dismiss_stale_reviews":true}' \
--field restrictions=null
```
## Step 2: Verify CI Workflows
1. Go to **Actions** tab
2. Ensure workflows are enabled:
- Secret Scanning
- Code Language Check
3. Test by creating a test PR
## Step 3: Configure Repository Settings
### General Settings
1. **Settings** โ **General**
2. Enable:
- โ **Issues** (for bug reports and feature requests)
- โ **Discussions** (optional, for community discussions)
- โ **Projects** (optional, for project management)
### Features
1. **Settings** โ **General** โ **Features**
2. Enable:
- โ **Issues**
- โ **Pull requests**
- โ **Discussions** (optional)
- โ **Wikis** (optional)
### Security
1. **Settings** โ **Security**
2. Enable:
- โ **Dependency graph**
- โ **Dependabot alerts**
- โ **Dependabot security updates**
## Step 4: Add Repository Topics
1. Go to repository main page
2. Click the gear icon next to "About"
3. Add topics: `dify`, `workflow`, `dsl`, `automation`, `ai`, `open-source`
## Step 5: Create Initial Issues Template
Create `.github/ISSUE_TEMPLATE/bug_report.md`:
```markdown
---
name: Bug Report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---
## Description
A clear description of the bug.
## Steps to Reproduce
1.
2.
3.
## Expected Behavior
What should happen.
## Actual Behavior
What actually happens.
## Environment
- Dify Version:
- OS:
- Browser (if applicable):
## Additional Context
Any other relevant information.
```
## Step 6: Enable Community Health Files
The repository already includes:
- โ
`CONTRIBUTING.md` - Contribution guidelines
- โ
`SECURITY.md` - Security policy
- โ
`.github/CODEOWNERS` - Code owners for auto-review requests
- โ
`.github/pull_request_template.md` - PR template
## Step 7: Test the Setup
1. Create a test branch: `git checkout -b test/branch-protection`
2. Make a small change
3. Push: `git push origin test/branch-protection`
4. Create a Pull Request
5. Verify:
- โ
CI checks run automatically
- โ
Direct merge is blocked
- โ
Approval is required
## Verification Checklist
- [ ] Branch protection rule is active
- [ ] CI workflows are running
- [ ] Direct push to main is blocked
- [ ] PR requires approval
- [ ] PR requires CI checks to pass
- [ ] CODEOWNERS file is in place
- [ ] Security policy is visible
- [ ] Contributing guidelines are accessible
## Next Steps
1. **Add a LICENSE file** (already done - Apache 2.0)
2. **Create a CHANGELOG.md** (optional)
3. **Set up release workflow** (optional)
4. **Enable GitHub Sponsors** (if applicable)
5. **Add project description** on GitHub
---
**Congratulations!** Your repository is now properly configured as an open-source project with protection rules in place.