Skip to content
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

feat: automatically make PRs to keep demo in sync with production #44

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
40 changes: 40 additions & 0 deletions .github/workflows/use-prod-sha-for-demo.yml
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sync Demo Hash with Production
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
push:
branches:
- main

jobs:
sync-demo-hash:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get production SHA
id: get_production_sha
run: |
PRODUCTION_SHA=$(jq -r '.head_sha' deploy/production/config.json)
echo "PRODUCTION_SHA=$PRODUCTION_SHA" >> $GITHUB_OUTPUT

- name: Update demo config
run: |
CONFIG_FILE="deploy/demo/config.json"
jq --arg sha "${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}" '.head_sha = $sha' $CONFIG_FILE > tmp.json && mv tmp.json $CONFIG_FILE

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Bump demo SHA to production SHA ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}"
title: "Bump demo to production: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}"
body: |
This PR automatically syncs the demo environment with the current production SHA.
corneliusroemer marked this conversation as resolved.
Show resolved Hide resolved

Production SHA: ${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}

Please review and approve to update the demo environment.
branch: sync-demo-with-production-${{ steps.get_production_sha.outputs.PRODUCTION_SHA }}
base: main
Loading