-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (81 loc) · 2.98 KB
/
deepseek-code-write.yml
File metadata and controls
91 lines (81 loc) · 2.98 KB
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
name: DeepSeekCode Write
on:
issue_comment:
types: [created]
pull_request_review:
types: [submitted]
pull_request_review_comment:
types: [created]
permissions:
contents: write
pull-requests: write
issues: write
actions: read
jobs:
write:
name: DeepSeekCode PR fix or patch
if: >-
${{
vars.DEEPSEEK_CODE_WRITE_ENABLED == 'true' &&
(
(github.event_name == 'issue_comment' && (contains(github.event.comment.body, '@deepseek fix') || contains(github.event.comment.body, '@deepseek patch'))) ||
(github.event_name == 'pull_request_review' && (contains(github.event.review.body, '@deepseek fix') || contains(github.event.review.body, '@deepseek patch'))) ||
(github.event_name == 'pull_request_review_comment' && (contains(github.event.comment.body, '@deepseek fix') || contains(github.event.comment.body, '@deepseek patch')))
)
}}
runs-on: ubuntu-latest
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
steps:
- name: Checkout DeepSeekCode
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Resolve PR target
id: target
if: ${{ env.DEEPSEEK_API_KEY != '' }}
run: |
set -euo pipefail
cargo run --locked -- github action \
--mode auto \
--dry-run \
--github-output \
--require-mode fix \
--require-mode patch \
--trigger "@deepseek"
- name: Resolve PR head
id: pr
if: ${{ env.DEEPSEEK_API_KEY != '' }}
run: |
set -euo pipefail
cargo run --locked -- github pr-head "${{ steps.target.outputs.reference }}" \
--repo-owner "${GITHUB_REPOSITORY%%/*}" \
--github-output
- name: Checkout PR head
if: ${{ env.DEEPSEEK_API_KEY != '' }}
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.head_ref }}
token: ${{ github.token }}
- name: Run DeepSeekCode write bridge
if: ${{ env.DEEPSEEK_API_KEY != '' }}
run: cargo run --locked -- github action --mode auto --trigger "@deepseek"
- name: Commit and push changes
if: ${{ env.DEEPSEEK_API_KEY != '' }}
run: |
set -euo pipefail
if git diff --quiet; then
echo "DeepSeekCode produced no workspace changes."
exit 0
fi
git config user.name "deepseek-code[bot]"
git config user.email "deepseek-code[bot]@users.noreply.github.com"
git add -A
git commit -m "deepseek: apply requested PR update"
git push origin "HEAD:${{ steps.pr.outputs.head_ref }}"
- name: Explain disabled secret
if: ${{ env.DEEPSEEK_API_KEY == '' }}
run: |
echo "DeepSeekCode write workflow skipped: configure the DEEPSEEK_API_KEY secret."