Skip to content

Commit

Permalink
Update automerge.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
localden committed Oct 14, 2024
1 parent 05df528 commit 7daa3f9
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Sync CI changes
name: Sync API Documentation Changes

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

permissions:
contents: write

jobs:
create-and-merge-prs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -24,11 +25,7 @@ jobs:
- name: Create PR from smoke-test to main
id: create_pr_smoke_test
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout -b pr-smoke-test-to-main
git push origin pr-smoke-test-to-main
pr_number=$(gh pr create --base main --head pr-smoke-test-to-main --title "Daily PR from smoke-test to main" --body "Automated PR from smoke-test to main" --json number -q .number)
pr_number=$(gh pr create --base main --head smoke-test --title "Daily PR from smoke-test to main" --body "Automated PR from smoke-test to main" | grep -o '[0-9]*')
echo "PR number created: $pr_number"
echo "pr_number=$pr_number" >> $GITHUB_ENV
Expand All @@ -37,8 +34,8 @@ jobs:
pr_number=${{ env.pr_number }}
echo "Waiting for checks on PR #$pr_number to pass"
while true; do
checks=$(gh pr checks "$pr_number" --json conclusion --jq '.conclusion')
if [[ "$checks" == "SUCCESS" ]]; then
checks=$(gh pr checks "$pr_number" | grep -o 'successful')
if [[ "$checks" == "successful" ]]; then
break
fi
echo "Checks still pending. Waiting..."
Expand All @@ -56,7 +53,7 @@ jobs:
git checkout main
git checkout -b pr-main-to-live
git push origin pr-main-to-live
pr_number_live=$(gh pr create --base live --head pr-main-to-live --title "Daily PR from main to live" --body "Automated PR from main to live" --json number -q .number)
pr_number_live=$(gh pr create --base live --head pr-main-to-live --title "Daily PR from main to live" --body "Automated PR from main to live" | grep -o '[0-9]*')
echo "PR number created for live: $pr_number_live"
echo "pr_number_live=$pr_number_live" >> $GITHUB_ENV
Expand All @@ -66,8 +63,8 @@ jobs:
pr_number_live=${{ env.pr_number_live }}
echo "Waiting for checks on PR #$pr_number_live to pass"
while true; do
checks_live=$(gh pr checks "$pr_number_live" --json conclusion --jq '.conclusion')
if [[ "$checks_live" == "SUCCESS" ]]; then
checks_live=$(gh pr checks "$pr_number_live" | grep -o 'successful')
if [[ "$checks_live" == "successful" ]]; then
break
fi
echo "Checks still pending. Waiting..."
Expand Down

0 comments on commit 7daa3f9

Please sign in to comment.