Skip to content

Commit 0b0e376

Browse files
Fix review comments: Use job outputs instead of shared filesystem
- Replace /tmp/old_value.txt with job outputs for passing data between jobs - Use vars.REPO instead of github.repository for API calls - This fixes the issue where jobs cannot share filesystem Co-Authored-By: Claude (mimo-v2-flash) <noreply@anthropic.com>
1 parent 083bda3 commit 0b0e376

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

.github/workflows/update-system-prompt.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ jobs:
3535
SYSTEM_PROMPT_CONTENT=$(cat system_prompt.md)
3636
3737
# 获取旧变量值
38-
OLD_VALUE=$(gh api /repos/${{ github.repository }}/actions/variables/SYSTEM_PROMPT --jq '.value' 2>/dev/null || echo "")
38+
OLD_VALUE=$(gh api /repos/${{ vars.REPO }}/actions/variables/SYSTEM_PROMPT --jq '.value' 2>/dev/null || echo "")
3939
4040
# 更新 GitHub Actions 变量
4141
gh api --method PATCH \
42-
/repos/${{ github.repository }}/actions/variables/SYSTEM_PROMPT \
42+
/repos/${{ vars.REPO }}/actions/variables/SYSTEM_PROMPT \
4343
-f name=SYSTEM_PROMPT \
4444
-f value="$SYSTEM_PROMPT_CONTENT"
4545
4646
echo "✓ SYSTEM_PROMPT 变量已更新"
4747
echo "文件大小: $(wc -c < system_prompt.md) 字符"
4848
49-
# 保存旧值到文件供下一步使用
50-
echo "$OLD_VALUE" > /tmp/old_value.txt
49+
# 将旧值输出到下一步
50+
echo "old_value<<EOF" >> $GITHUB_OUTPUT
51+
echo "$OLD_VALUE" >> $GITHUB_OUTPUT
52+
echo "EOF" >> $GITHUB_OUTPUT
5153
5254
create-diff-issue:
5355
needs: update
@@ -65,8 +67,8 @@ jobs:
6567

6668
- name: Create diff issue
6769
run: |
68-
# 读取旧值
69-
OLD_VALUE=$(cat /tmp/old_value.txt)
70+
# 读取旧值(来自 update job 的输出)
71+
OLD_VALUE="${{ needs.update.outputs.old_value }}"
7072
# 读取新值
7173
NEW_VALUE=$(cat system_prompt.md)
7274

0 commit comments

Comments
 (0)