Skip to content

Commit

Permalink
ci: Push to testing repo to trigger CI, wait for it to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed May 24, 2024
1 parent 30d3bc9 commit b992fbd
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,34 @@ jobs:

- name: Test project generation and workflow
run: bash tests/test_project.sh

- name: Wait success of generated project's workflow
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd tests/tmp || exit 1
if ! git remote -v | grep -q pawamoy-testing; then
echo "Origin is not the testing repository, exiting..."
exit 1
fi
echo "Pushing to testing repository..."
git push --tags --force
while true; do
echo "Waiting 5 seconds..."
sleep 5
echo "Fetching CI workflow..."
if ! output=$(gh run list --repo pawamoy/pawamoy-testing --branch 0.1.1 --limit 1 --workflow "ci.yml" --json status,conclusion); then
continue
fi
status=$(jq -r ".[0].status" <<< "$output")
if [ "${status}" = "completed" ]; then
echo "Workflow completed!"
conclusion=$(jq -r ".[0].conclusion" <<< "$output")
echo "Status: ${conclusion}"
[ "${conclusion}" == "success" ] && break || exit 1
fi
done
echo "Delete all testing releases..."
for tag in $(gh release list --repo pawamoy/pawamoy-testing --json tagName --jq ".[].tagName"); do
gh release delete --repo pawamoy/pawamoy-testing --tag "${tag}" --yes --cleanup-tag
done

0 comments on commit b992fbd

Please sign in to comment.