|
| 1 | +# Copyright (C) Marc Hoersken |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# Redistribution and use in source and binary forms, with or without |
| 5 | +# modification, are permitted provided that the following conditions are met: |
| 6 | +# |
| 7 | +# * Redistributions of source code must retain the above copyright notice, this |
| 8 | +# list of conditions and the following disclaimer. |
| 9 | +# |
| 10 | +# * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | +# this list of conditions and the following disclaimer in the documentation |
| 12 | +# and/or other materials provided with the distribution. |
| 13 | +# |
| 14 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 15 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 18 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 19 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 20 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 21 | +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 22 | +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | +# |
| 25 | +# SPDX-License-Identifier: BSD-3-Clause |
| 26 | + |
| 27 | +name: AppVeyor Status Report |
| 28 | + |
| 29 | +on: |
| 30 | + status |
| 31 | + |
| 32 | +concurrency: |
| 33 | + group: ${{ github.workflow }}-${{ github.event.sha }}-${{ github.event.target_url }} |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +permissions: |
| 37 | + statuses: write |
| 38 | + |
| 39 | +jobs: |
| 40 | + split: |
| 41 | + runs-on: ubuntu-latest |
| 42 | + if: ${{ github.event.sender.login == 'appveyor[bot]' }} |
| 43 | + steps: |
| 44 | + - name: Create individual AppVeyor build statuses |
| 45 | + if: ${{ github.event.sha && github.event.target_url }} |
| 46 | + env: |
| 47 | + APPVEYOR_COMMIT_SHA: ${{ github.event.sha }} |
| 48 | + APPVEYOR_TARGET_URL: ${{ github.event.target_url }} |
| 49 | + APPVEYOR_REPOSITORY: ${{ github.event.repository.full_name }} |
| 50 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + run: | |
| 52 | + echo ${APPVEYOR_TARGET_URL} | sed 's/\/project\//\/api\/projects\//' | xargs -t -n1 curl -s | \ |
| 53 | + jq -c '.build.jobs[] | {target_url: ($target_url + "/job/" + .jobId), |
| 54 | + context: (.name | sub("^(Environment: )?"; "AppVeyor / ")), |
| 55 | + state: (.status | sub("queued"; "pending") |
| 56 | + | sub("starting"; "pending") |
| 57 | + | sub("running"; "pending") |
| 58 | + | sub("failed"; "failure") |
| 59 | + | sub("cancelled"; "error")), |
| 60 | + description: .status}' \ |
| 61 | + --arg target_url ${APPVEYOR_TARGET_URL} | tee /dev/stderr | parallel --pipe -j 1 -N 1 \ |
| 62 | + gh api --silent --input - repos/${APPVEYOR_REPOSITORY}/statuses/${APPVEYOR_COMMIT_SHA} |
0 commit comments