Generate repo #432
This file contains 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: Generate repo | |
on: | |
schedule: | |
- cron: "0 6,18 * * *" | |
workflow_dispatch: | |
jobs: | |
generate-repo: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout local repository | |
uses: actions/checkout@v4 | |
- name: Checkout remote repository | |
uses: actions/checkout@v4 | |
with: | |
repository: "ethpandaops/xatu" | |
path: "xatu" | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Run Docker Compose in remote repo | |
run: | | |
cd xatu | |
docker compose --profile clickhouse up -d | |
- name: Wait for service on port 8123 to be up | |
run: | | |
timeout=60 # wait for up to 60 seconds | |
while ! curl --output /dev/null --silent --head --fail http://localhost:8123; do | |
printf '.' | |
timeout=$((timeout-1)) | |
if [ "$timeout" -le 0 ]; then | |
echo "Service did not become available on port 8123 in time" | |
exit 1 | |
fi | |
sleep 1 | |
done | |
echo "Service is up on port 8123" | |
- name: Wait for docker container xatu-clickhouse-migrator to exit 0 | |
run: | | |
set -e # This will cause the script to exit on the first error | |
EXIT_CODE=$(docker wait xatu-clickhouse-migrator) | |
echo "Exit code: $EXIT_CODE" | |
if [ "$EXIT_CODE" != "0" ]; then | |
echo "Container exited with code $EXIT_CODE, failing the job." | |
exit 1 | |
fi | |
- name: Go to root directory | |
run: cd .. | |
- name: Run generate-schema.sh for SCHEMA.md | |
run: ./generate-schema.sh | |
- name: Run generate-schema.sh for SCHEMA.hugo.md | |
env: | |
MODE: hugo | |
SCHEMA: SCHEMA.hugo.md | |
run: ./generate-schema.sh | |
- name: Run generate-schema.sh for SCHEMA.all.md | |
env: | |
MODE: all | |
SCHEMA: SCHEMA.all.md | |
run: ./generate-schema.sh | |
- name: Run generate-readme.sh for README.md | |
run: ./generate-readme.sh | |
- name: Run generate-readme.sh for README.hugo.md | |
env: | |
MODE: hugo | |
README: README.hugo.md | |
run: ./generate-readme.sh | |
- name: Run generate-bigquery.sh | |
run: ./generate-bigquery.sh | |
- name: Cleanup before commit | |
run: | | |
cd xatu | |
docker compose down | |
cd .. | |
rm -rf xatu | |
- name: Git diff | |
run: | | |
git diff --exit-code || echo "No changes to commit" | |
- name: Commit changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add -A | |
git commit -m "Update schema" || echo "No changes to commit" | |
git push | |
- name: Trigger deploy hook | |
run: | | |
curl -X POST "${{ secrets.HOMEPAGE_HOOK_URL }}" |