Skip to content

Fix workflow push logic for README navigation updates#15

Merged
LjyYano merged 4 commits into
masterfrom
copilot/fix-readme-navigation-issue
Dec 12, 2025
Merged

Fix workflow push logic for README navigation updates#15
LjyYano merged 4 commits into
masterfrom
copilot/fix-readme-navigation-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 12, 2025

GitHub Action successfully generates README article navigation but fails to push changes due to faulty conditional logic.

Changes

  • Simplified commit/push flow: Moved git push inside the commit conditional block instead of a separate step that checked for uncommitted files after commit
  • Removed redundant push step: The separate "Push changes" step was checking git status --porcelain after files were already committed, causing the condition to always fail

Before:

- name: Commit changes
  run: |
    if git status --porcelain README.md | grep README.md; then
      git config user.name "github-actions[bot]"
      git config user.email "github-actions[bot]@users.noreply.github.com"
      git add README.md
      git commit -m "chore: update README nav"
    fi

- name: Push changes
  if: success()
  run: |
    if git rev-parse --verify HEAD >/dev/null 2>&1 && git status --porcelain README.md | grep README.md; then
      git push
    fi

After:

- name: Commit changes
  run: |
    git config user.name "github-actions[bot]"
    git config user.email "github-actions[bot]@users.noreply.github.com"
    if git status --porcelain README.md | grep README.md; then
      git add README.md
      git commit -m "chore: update README nav"
      git push
    fi
Original prompt

github action,最终没有生成 readme 里面的文章导航


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@feihong247
Copy link
Copy Markdown

feihong247 commented Dec 12, 2025 via email

Copilot AI and others added 3 commits December 12, 2025 05:16
Co-authored-by: LjyYano <9548512+LjyYano@users.noreply.github.com>
The workflow was failing to push changes because it checked for uncommitted files after committing. Fixed by moving the git push command inside the commit conditional block.

Co-authored-by: LjyYano <9548512+LjyYano@users.noreply.github.com>
Co-authored-by: LjyYano <9548512+LjyYano@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with article navigation in README Fix workflow push logic for README navigation updates Dec 12, 2025
Copilot AI requested a review from LjyYano December 12, 2025 05:21
@LjyYano LjyYano marked this pull request as ready for review December 12, 2025 05:31
@LjyYano LjyYano merged commit d0e7204 into master Dec 12, 2025
1 check passed
@LjyYano LjyYano deleted the copilot/fix-readme-navigation-issue branch December 12, 2025 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants