Update the 'data/latest.json' file #255
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update 'ai/liquid.mdc' and 'data/latest.json' files | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current repo | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Write latest sha to latest.json | |
| run: | | |
| echo -e { \"revision\": \"$(git rev-parse HEAD)\" }\\n > data/latest.json | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Generate AI file | |
| run: yarn generate:ai | |
| - name: Create Pull Request | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| # Configure git | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Create and switch to new branch | |
| BRANCH_NAME="update-ai-docs-$(date +%Y%m%d-%H%M%S)" | |
| git checkout -b "$BRANCH_NAME" | |
| # Commit changes | |
| git add ai/liquid.mdc | |
| git add data/latest.json | |
| git commit -m "Update 'ai/liquid.mdc' and 'data/latest.json' files" | |
| # Push branch | |
| git push origin "$BRANCH_NAME" | |
| # Create pull request using GitHub CLI | |
| gh pr create \ | |
| --title "Update 'ai/liquid.mdc' and 'data/latest.json' files" \ | |
| --body "Automated update of AI documentation and latest revision data. | |
| - Updated \`ai/liquid.mdc\` with latest documentation | |
| - Updated \`data/latest.json\` with current revision SHA" \ | |
| --base main \ | |
| --head "$BRANCH_NAME" | |
| else | |
| echo "No changes to commit" | |
| fi |