Skip to content

Commit b992fbd

Browse files
committed
ci: Push to testing repo to trigger CI, wait for it to pass
1 parent 30d3bc9 commit b992fbd

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/ci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,34 @@ jobs:
8686

8787
- name: Test project generation and workflow
8888
run: bash tests/test_project.sh
89+
90+
- name: Wait success of generated project's workflow
91+
env:
92+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
run: |
94+
cd tests/tmp || exit 1
95+
if ! git remote -v | grep -q pawamoy-testing; then
96+
echo "Origin is not the testing repository, exiting..."
97+
exit 1
98+
fi
99+
echo "Pushing to testing repository..."
100+
git push --tags --force
101+
while true; do
102+
echo "Waiting 5 seconds..."
103+
sleep 5
104+
echo "Fetching CI workflow..."
105+
if ! output=$(gh run list --repo pawamoy/pawamoy-testing --branch 0.1.1 --limit 1 --workflow "ci.yml" --json status,conclusion); then
106+
continue
107+
fi
108+
status=$(jq -r ".[0].status" <<< "$output")
109+
if [ "${status}" = "completed" ]; then
110+
echo "Workflow completed!"
111+
conclusion=$(jq -r ".[0].conclusion" <<< "$output")
112+
echo "Status: ${conclusion}"
113+
[ "${conclusion}" == "success" ] && break || exit 1
114+
fi
115+
done
116+
echo "Delete all testing releases..."
117+
for tag in $(gh release list --repo pawamoy/pawamoy-testing --json tagName --jq ".[].tagName"); do
118+
gh release delete --repo pawamoy/pawamoy-testing --tag "${tag}" --yes --cleanup-tag
119+
done

0 commit comments

Comments
 (0)