|
95 | 95 | automated-pr |
96 | 96 | version-bump |
97 | 97 |
|
98 | | - - name: Trigger brew test-bot |
99 | | - if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number |
100 | | - uses: actions/github-script@v7 |
101 | | - with: |
102 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
103 | | - script: | |
104 | | - await github.rest.actions.createWorkflowDispatch({ |
105 | | - owner: context.repo.owner, |
106 | | - repo: context.repo.repo, |
107 | | - workflow_id: 'tests.yml', |
108 | | - ref: 'main', |
109 | | - inputs: { |
110 | | - head_sha: '${{ steps.create-pr.outputs.pull-request-head-sha }}' |
111 | | - } |
112 | | - }); |
113 | | -
|
114 | | - # Wait for test-bot CI to complete |
115 | | - - name: Wait for test-bot to complete |
116 | | - if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number |
117 | | - run: | |
118 | | - echo "Waiting for test-bot workflow to complete..." |
119 | | - timeout=1800 # 30 minutes in seconds |
120 | | - interval=60 # Check every minute |
121 | | - elapsed=0 |
122 | | - |
123 | | - while [ $elapsed -lt $timeout ]; do |
124 | | - STATUS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
125 | | - "https://api.github.com/repos/${{ github.repository }}/actions/runs?status=completed&event=pull_request&head_sha=$(git rev-parse HEAD)") |
126 | | - |
127 | | - COMPLETED=$(echo "$STATUS" | jq -r '.workflow_runs[] | select(.name == "brew test-bot") | .status') |
128 | | - |
129 | | - if [ "$COMPLETED" = "completed" ]; then |
130 | | - CONCLUSION=$(echo "$STATUS" | jq -r '.workflow_runs[] | select(.name == "brew test-bot") | .conclusion') |
131 | | - if [ "$CONCLUSION" = "success" ]; then |
132 | | - echo "test-bot workflow completed successfully!" |
133 | | - break |
134 | | - elif [ "$CONCLUSION" = "failure" ]; then |
135 | | - echo "test-bot workflow failed!" |
136 | | - exit 1 |
137 | | - fi |
138 | | - fi |
139 | | - |
140 | | - sleep $interval |
141 | | - elapsed=$((elapsed + interval)) |
142 | | - echo "Still waiting... ($elapsed seconds elapsed)" |
143 | | - done |
144 | | - |
145 | | - if [ $elapsed -ge $timeout ]; then |
146 | | - echo "Timeout waiting for test-bot workflow to complete" |
147 | | - exit 1 |
148 | | - fi |
149 | | -
|
150 | | - - name: Add pr-pull label |
151 | | - if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number |
152 | | - uses: actions/github-script@v7 |
153 | | - with: |
154 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
155 | | - script: | |
156 | | - github.rest.issues.addLabels({ |
157 | | - owner: context.repo.owner, |
158 | | - repo: context.repo.repo, |
159 | | - issue_number: ${{ steps.create-pr.outputs.pull-request-number }}, |
160 | | - labels: ['pr-pull'] |
161 | | - }) |
0 commit comments