-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Develop #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: AI Generate Post | ||
|
|
||
| # Generates a blog post from memory/ via the selected AI provider, then opens | ||
| # a Pull Request against develop for human review. Nothing is published | ||
| # directly — merging the PR (and later develop -> main) does the publishing. | ||
| # | ||
| # Triggers: | ||
| # - daily on a schedule | ||
| # - manually via the Actions tab | ||
| # | ||
| # Secrets (optional): ANTHROPIC_API_KEY or OPENAI_API_KEY. If neither is set, | ||
| # the generator runs its dry-run stub and still opens a PR for review. | ||
|
|
||
| on: | ||
| schedule: | ||
| # 22:43 UTC daily (~06:43 Asia/Shanghai) — before the publish workflow. | ||
| - cron: "43 22 * * *" | ||
| workflow_dispatch: | ||
| inputs: | ||
| provider: | ||
| description: "Provider override (anthropic | openai | dryrun)" | ||
| required: false | ||
| default: "" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| generate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: develop | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
|
Comment on lines
+33
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/generate.ymlRepository: xiami303/OpenBlog Length of output: 2999 Pin the third-party actions to commit SHAs.
🧰 Tools🪛 zizmor (1.25.2)[warning] 33-35: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [error] 33-33: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) [error] 37-37: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSources: MCP tools, Linters/SAST tools |
||
| with: | ||
| node-version: "20" | ||
| cache: "npm" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Install AI SDK (if a key is configured) | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| run: | | ||
| if [ -n "$ANTHROPIC_API_KEY" ]; then npm install @anthropic-ai/sdk; fi | ||
| if [ -n "$OPENAI_API_KEY" ]; then npm install openai; fi | ||
|
|
||
| - name: Generate post | ||
| env: | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| OPENBLOG_PROVIDER: ${{ github.event.inputs.provider }} | ||
| run: node scripts/generate.mjs --date "$(date -u +%F)" | ||
|
|
||
| - name: Open pull request | ||
| uses: peter-evans/create-pull-request@v6 | ||
| with: | ||
| base: develop | ||
| branch: ai/post-${{ github.run_id }} | ||
| add-paths: posts/** | ||
| commit-message: "AI: new post from memory ($(date -u +%F))" | ||
| title: "AI draft: new post from memory ($(date -u +%F))" | ||
|
Comment on lines
+66
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/generate.yml | head -80 | tail -20Repository: xiami303/OpenBlog Length of output: 1059 🌐 Web query:
💡 Result: The peter-evans/create-pull-request GitHub action does not perform internal shell substitution on its inputs [1][2]. Instead, it relies on the standard GitHub Actions workflow syntax for processing values before they are passed to the action [1]. To use variables, environment values, or command outputs within the title or commit-message parameters, you must use the Citations:
Replace shell substitution with GitHub Actions expression or output variable.
🤖 Prompt for AI AgentsSource: MCP tools |
||
| body: | | ||
| Auto-generated blog post from `memory/` notes, for review. | ||
|
|
||
| - Generated by the **AI Generate Post** workflow. | ||
| - Review the content, then merge into `develop`. | ||
| - Release happens separately via `develop` -> `main`. | ||
| labels: ai-generated | ||
| delete-branch: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| date: 2026-06-12 | ||
| tags: [思考, 工具] | ||
| --- | ||
|
|
||
| # 今天的零散想法 | ||
|
|
||
| - 读到一句话:「工具的价值不在于它能做什么,而在于它让你不必做什么。」一直在想,博客最该被自动化掉的不是「写」,而是「坚持写」这件事本身。 | ||
| - 试着把一天里冒出来的念头随手记到这个 memory/ 目录,哪怕只是一句话。它们是原料,不是成品。 | ||
| - 一个观察:碎片想法之所以容易丢,是因为它们没有「被处理」的下一步。如果记下来之后会自动被沉淀成一篇文章,记录的动力就完全不一样了。 | ||
| - 待深入:记忆 → 文章 的转化,关键不是润色,而是「从一堆零散里找出那条主线」。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: xiami303/OpenBlog
Length of output: 94
🏁 Script executed:
Repository: xiami303/OpenBlog
Length of output: 122
🏁 Script executed:
# Read the full generate.yml workflow file cat -n .github/workflows/generate.ymlRepository: xiami303/OpenBlog
Length of output: 2999
🌐 Web query:
actions/checkout persist-credentials default behavior GitHub Actions💡 Result:
The default behavior of the persist-credentials input in the actions/checkout GitHub Action is true [1][2][3]. When set to true (the default), the action automatically configures the local Git repository with the provided GitHub token or SSH key [1][4][3]. This allows your workflow scripts to execute authenticated Git commands (such as git fetch or git push) without requiring manual credential configuration [1][5][6]. For security, the action now stores these credentials in a separate file under $RUNNER_TEMP rather than directly within the.git/config file, and the token is automatically removed during post-job cleanup [1][6]. If you do not want these credentials persisted in the Git configuration, you can opt out by setting persist-credentials to false in your workflow file [1][5][7].
Citations:
🌐 Web query:
peter-evans/create-pull-request credentials persist-credentials security💡 Result:
When using the peter-evans/create-pull-request action in workflows that also use actions/checkout, you may encounter an HTTP 400 error described as a "Duplicate header: Authorization" [1][2][3]. This occurs because actions/checkout (specifically from version 6 onwards) persists a git credential by default, while peter-evans/create-pull-request also injects its own authentication header [4][2][3]. When Git attempts to push changes, both headers are sent, leading GitHub to reject the request [1][2][3]. To resolve this, the recommended approach is to set persist-credentials to false in your actions/checkout step [1][2][3]. This prevents the checkout action from storing credentials, leaving the peter-evans/create-pull-request action to handle the necessary authentication for the subsequent push [1][2]. Example workflow configuration: - uses: actions/checkout@v6 with: persist-credentials: false - name: Create Pull Request uses: peter-evans/create-pull-request@v8 with: token: ${{ secrets.GITHUB_TOKEN }} While the peter-evans/create-pull-request action has implemented internal measures to attempt to mitigate compatibility issues with actions/checkout@v6 (such as temporarily hiding credential files) [4][5][6], setting persist-credentials: false remains a common and effective practice to ensure reliable authentication and avoid duplicate header conflicts [1][2][3].
Citations:
Disable credential persistence on checkout.
actions/checkout@v4keeps credentials enabled by default, persisting the GitHub token in Git configuration for subsequent steps. Since this workflow usespeter-evans/create-pull-request@v6which manages its own authentication, setpersist-credentials: falseto narrow the credential blast radius and avoid authentication conflicts.Suggested fix
- uses: actions/checkout@v4 with: ref: develop + persist-credentials: false🧰 Tools
🪛 zizmor (1.25.2)
[warning] 33-35: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
[error] 33-33: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents
Sources: MCP tools, Linters/SAST tools