|
43 | 43 | runs-on: ubuntu-latest |
44 | 44 | outputs: |
45 | 45 | DEPENDS_ON: ${{ steps.parse-dependencies.outputs.DEPENDS_ON }} |
46 | | - ALL_PR: ${{ steps.parse-dependencies.outputs.ALL_PR }} |
47 | 46 | steps: |
48 | 47 | - name: Determine Target Branches |
49 | 48 | id: gittargets |
@@ -163,9 +162,6 @@ jobs: |
163 | 162 | if: ${{ github.event_name == 'pull_request' }} |
164 | 163 | env: |
165 | 164 | PR_BODY: ${{ github.event.pull_request.body }} |
166 | | - PR_REPO: ${{ github.repository }} |
167 | | - PR_NUM: ${{ github.event.pull_request.number }} |
168 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
169 | 165 | run: | |
170 | 166 | set -x |
171 | 167 | printf '%s\n' "$PR_BODY" > pull_request.body.txt |
@@ -198,22 +194,11 @@ jobs: |
198 | 194 | echo "Validated DEPENDS_ON: $DEPENDS_ON" |
199 | 195 | echo "DEPENDS_ON=$DEPENDS_ON" >> "$GITHUB_OUTPUT" |
200 | 196 |
|
201 | | - ALL_PR="$DEPENDS_ON" |
202 | | - if [ -n "$ALL_PR" ]; then |
203 | | - ALL_PR="$ALL_PR ${PR_REPO}/pull/${PR_NUM}" |
204 | | - fi |
205 | | - ALL_PR=$(echo "$ALL_PR" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') |
206 | | - echo "ALL_PR=$ALL_PR" >> "$GITHUB_OUTPUT" |
207 | | -
|
208 | 197 | - name: Fetch and Cherry-pick Dependent PRs |
209 | 198 | if: ${{ github.event_name == 'pull_request' && steps.parse-dependencies.outputs.DEPENDS_ON != '' }} |
210 | 199 | env: |
211 | 200 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
212 | 201 | DEPENDS_ON: ${{ steps.parse-dependencies.outputs.DEPENDS_ON }} |
213 | | - ALL_PR: ${{ steps.parse-dependencies.outputs.ALL_PR }} |
214 | | - PR_REPO: ${{ github.repository }} |
215 | | - PR_NUM: ${{ github.event.pull_request.number }} |
216 | | - CURRENT_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
217 | 202 | run: | |
218 | 203 | set -x |
219 | 204 | git config --global user.email "nuttx-ci@zhn-test.com" |
@@ -261,17 +246,6 @@ jobs: |
261 | 246 | continue |
262 | 247 | fi |
263 | 248 |
|
264 | | - curl -s -X POST \ |
265 | | - -H "Authorization: token ${GITHUB_TOKEN}" \ |
266 | | - -H "Accept: application/vnd.github.v3+json" \ |
267 | | - "https://api.github.com/repos/$REPO_FULL/statuses/$PR_SHA" \ |
268 | | - -d '{ |
269 | | - "state": "pending", |
270 | | - "description": "CI triggered by '"${PR_REPO}"'/pull/'"${PR_NUM}"'", |
271 | | - "context": "NuttX CI (depends-on)", |
272 | | - "target_url": "'"${CURRENT_ACTION_URL}"'" |
273 | | - }' || true |
274 | | -
|
275 | 249 | cd "$LOCAL_PATH" |
276 | 250 |
|
277 | 251 | if ! git fetch origin "pull/$PR_NUMBER/head:pr-$PR_NUMBER" >> "$fetch_log" 2>&1; then |
@@ -693,71 +667,3 @@ jobs: |
693 | 667 | name: msvc-builds |
694 | 668 | path: ./sources/buildartifacts/ |
695 | 669 | continue-on-error: true |
696 | | - |
697 | | - |
698 | | - Post-Processing: |
699 | | - needs: [Fetch-Source, Linux, OOT-Build, macOS, msys2, msvc] |
700 | | - if: ${{ always() && needs.Fetch-Source.outputs.DEPENDS_ON != '' }} |
701 | | - runs-on: ubuntu-latest |
702 | | - permissions: |
703 | | - statuses: write |
704 | | - pull-requests: read |
705 | | - issues: write |
706 | | - steps: |
707 | | - - name: Update Dependent PR Statuses |
708 | | - env: |
709 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
710 | | - DEPENDS_ON: ${{ needs.Fetch-Source.outputs.DEPENDS_ON }} |
711 | | - ALL_PR: ${{ needs.Fetch-Source.outputs.ALL_PR }} |
712 | | - LINUX_RESULT: ${{ needs.Linux.result }} |
713 | | - OOT_RESULT: ${{ needs.OOT-Build.result }} |
714 | | - MACOS_RESULT: ${{ needs.macOS.result }} |
715 | | - MSYS2_RESULT: ${{ needs.msys2.result }} |
716 | | - MSVC_RESULT: ${{ needs.msvc.result }} |
717 | | - PR_REPO: ${{ github.repository }} |
718 | | - PR_NUM: ${{ github.event.pull_request.number }} |
719 | | - CURRENT_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
720 | | - run: | |
721 | | - echo "Build results: Linux=$LINUX_RESULT OOT=$OOT_RESULT macOS=$MACOS_RESULT msys2=$MSYS2_RESULT msvc=$MSVC_RESULT" |
722 | | -
|
723 | | - ci_status="success" |
724 | | - for result in "$LINUX_RESULT" "$OOT_RESULT" "$MACOS_RESULT" "$MSYS2_RESULT" "$MSVC_RESULT"; do |
725 | | - if [ "$result" = "failure" ]; then |
726 | | - ci_status="failure" |
727 | | - break |
728 | | - fi |
729 | | - done |
730 | | -
|
731 | | - echo "Overall CI status: $ci_status" |
732 | | -
|
733 | | - for DEPENDENCY in $DEPENDS_ON; do |
734 | | - REPO_FULL=$(echo "$DEPENDENCY" | awk -F'/pull/' '{print $1}') |
735 | | - PR_NUMBER=$(echo "$DEPENDENCY" | awk -F'/pull/' '{print $2}') |
736 | | -
|
737 | | - PR_DATA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ |
738 | | - "https://api.github.com/repos/$REPO_FULL/pulls/$PR_NUMBER") |
739 | | - LATEST_SHA=$(echo "$PR_DATA" | jq -r '.head.sha') |
740 | | -
|
741 | | - if [ -z "$LATEST_SHA" ] || [ "$LATEST_SHA" = "null" ]; then |
742 | | - echo "::warning::Failed to get SHA for $DEPENDENCY, skipping status update" |
743 | | - continue |
744 | | - fi |
745 | | -
|
746 | | - curl -s -X POST \ |
747 | | - -H "Authorization: token ${GITHUB_TOKEN}" \ |
748 | | - -H "Accept: application/vnd.github.v3+json" \ |
749 | | - "https://api.github.com/repos/$REPO_FULL/statuses/$LATEST_SHA" \ |
750 | | - -d '{ |
751 | | - "state": "'"$ci_status"'", |
752 | | - "description": "CI '"$ci_status"' (triggered by '"${PR_REPO}"'/pull/'"${PR_NUM}"')", |
753 | | - "context": "NuttX CI (depends-on)", |
754 | | - "target_url": "'"${CURRENT_ACTION_URL}"'" |
755 | | - }' |
756 | | -
|
757 | | - COMMENT_BODY="NuttX CI $ci_status.\nPR list: $ALL_PR\nCI: $CURRENT_ACTION_URL" |
758 | | - curl -s -X POST \ |
759 | | - -H "Authorization: token ${GITHUB_TOKEN}" \ |
760 | | - -H "Accept: application/vnd.github.v3+json" \ |
761 | | - "https://api.github.com/repos/$REPO_FULL/issues/$PR_NUMBER/comments" \ |
762 | | - -d "{\"body\": \"$COMMENT_BODY\"}" |
763 | | - done |
0 commit comments