Skip to content

update gh workflow to create PR when ai docs are affected #1004

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aswamy
Copy link

@aswamy aswamy commented Jul 16, 2025

TL;DR

Changed the GitHub workflow to create pull requests for AI documentation updates instead of directly pushing to main.

What changed?

  • Modified the update-latest.yml workflow to create a pull request for changes instead of pushing directly to main
  • Added branch creation with timestamp-based naming (update-ai-docs-YYYYMMDD-HHMMSS)
  • Configured the workflow to use GitHub CLI to create a pull request with a descriptive title and body
  • Updated the git configuration to use the standard GitHub Actions bot identity

How to test?

  1. Trigger the workflow manually or wait for its scheduled run
  2. Verify that a new pull request is created when there are changes to the AI documentation
  3. Confirm the PR contains the expected changes to ai/liquid.mdc and data/latest.json
  4. Check that the PR has the correct title and description

Example run: https://github.com/Shopify/theme-liquid-docs/actions/runs/16328413540/job/46124461065
Example PR created: #1006
⚠️ NOTE: It also contains the file in this PR since it branches off of main. You can ignore this commit in that PR, only see the changes to ai/liquid.mdc and data/latest.json

Why make this change?

This change improves the workflow by creating pull requests instead of direct commits to main, which:

  • Provides better visibility into documentation updates
  • Allows for review before changes are merged
  • Creates a clearer history of documentation updates
  • Follows best practices for repository management by avoiding direct pushes to the main branch

Copy link
Author

aswamy commented Jul 16, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@aswamy aswamy marked this pull request as ready for review July 16, 2025 19:12
@aswamy aswamy requested a review from a team as a code owner July 16, 2025 19:12
@aswamy aswamy force-pushed the 07-16-update_gh_workflow_to_create_pr_when_ai_docs_are_affected branch from a64db13 to 7841df5 Compare July 16, 2025 19:19
@aswamy aswamy force-pushed the 07-16-update_gh_workflow_to_create_pr_when_ai_docs_are_affected branch from 7841df5 to 3b5f02e Compare July 16, 2025 19:22
@aswamy aswamy requested a review from graygilmore July 16, 2025 19:23
Copy link
Contributor

@karreiro karreiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, @aswamy!

Since we're aiming to create a pull request now, do you think we should change what triggers this workflow?

If we leave it as is, it seems like a new PR would be created on every commit, including when we merge the data/latest.json PR itself.

Maybe we could set this workflow to be triggered manually instead, or set the revision value using a different approach to prevent the creation of too many PRs. What do you think?

Copy link
Author

aswamy commented Jul 17, 2025

If we leave it as is, it seems like a new PR would be created on every commit, including when we merge the data/latest.json PR itself.

Wouldn't this only be created if we merge to main? Also this only creates the PR IF it needs to be created since we have the if [[ -n "$(git status --porcelain)" ]]; then line.

I guess if we forget to merge one, we can see a lot of these PRs pile up 🤔

@karreiro
Copy link
Contributor

karreiro commented Jul 18, 2025

Wouldn't this only be created if we merge to main? Also this only creates the PR IF it needs to be created since we have the if [[ -n "$(git status --porcelain)" ]]; then line.

As soon as we merge a PR updating data/latest.json, I believe the value in the line below will change and the workflow will create a new PR:

echo -e { \"revision\": \"$(git rev-parse HEAD)\" }\\n > data/latest.json

Am I missing something?

@aswamy, please, feel free to proceed with the merge, if you'd like to validate that assumption :)

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