mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-03-20 11:40:32 -05:00
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](7a3fe6cf4c...4b73464bb3)
---
updated-dependencies:
- dependency-name: actions/setup-go
dependency-version: 6.3.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
112 lines
3.9 KiB
YAML
112 lines
3.9 KiB
YAML
name: generate examples
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
generate:
|
|
runs-on: ubicloud-standard-2
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Install Task
|
|
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
|
|
with:
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
|
|
with:
|
|
go-version: "1.25"
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
|
|
with:
|
|
version: 10.16.1
|
|
run_install: false
|
|
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: '3.14'
|
|
- name: Generate snippets
|
|
run: task install-dependencies pre-commit-install generate-docs -v
|
|
|
|
- name: Check for changes in examples directory
|
|
id: verify-changed-files
|
|
run: |
|
|
# Check if there are any changes
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
CHANGED_FILES=$(git status --porcelain | awk '{print $2}')
|
|
NON_EXAMPLES_CHANGES=$(echo "$CHANGED_FILES" | grep -v "^examples/" || true)
|
|
|
|
if [ -n "$NON_EXAMPLES_CHANGES" ]; then
|
|
echo "Error: Changes detected outside of examples directory:"
|
|
echo "$NON_EXAMPLES_CHANGES"
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
exit 1
|
|
else
|
|
echo "changed=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
else
|
|
echo "changed=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Create branch and commit changes
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
run: |
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
BRANCH_NAME="regenerate-examples-${{ github.sha }}"
|
|
git checkout -b "$BRANCH_NAME"
|
|
git add examples/
|
|
git commit -m "chore: regenerate examples"
|
|
git push origin "$BRANCH_NAME"
|
|
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
|
id: create-branch
|
|
|
|
- name: Close existing autogenerated-docs PRs
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
EXISTING_PRS=$(gh pr list --label "autogenerated-docs" --state open --json number --jq '.[].number')
|
|
|
|
for pr in $EXISTING_PRS; do
|
|
if [ -n "$pr" ]; then
|
|
echo "Closing existing autogenerated-docs PR #$pr"
|
|
gh pr close $pr --comment "Closing in favor of newer autogenerated-docs PR"
|
|
fi
|
|
done
|
|
|
|
- name: Create Pull Request
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr create \
|
|
--title "chore: regenerate examples" \
|
|
--body "Automated regeneration of examples from the main branch." \
|
|
--head "${{ steps.create-branch.outputs.branch_name }}" \
|
|
--base main \
|
|
--label "autogenerated-docs"
|
|
echo "pr_number=$(gh pr list --head ${{ steps.create-branch.outputs.branch_name }} --json number --jq '.[0].number')" >> $GITHUB_OUTPUT
|
|
id: create-pr
|
|
|
|
- name: Request review from triggering author
|
|
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
AUTHOR="${{ github.actor }}"
|
|
|
|
if [ "$AUTHOR" != "github-actions[bot]" ]; then
|
|
gh pr edit "${{ steps.create-branch.outputs.branch_name }}" --add-reviewer "$AUTHOR" || {
|
|
gh pr comment "${{ steps.create-branch.outputs.branch_name }}" --body "@$AUTHOR Please review this autogenerated PR"
|
|
}
|
|
echo "Requested review from $AUTHOR"
|
|
else
|
|
echo "Skipping review request as author is github-actions bot"
|
|
fi
|