diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index b830ae44c..fb78c398d 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -70,3 +70,27 @@ jobs: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -P deploy deploy + + check_status: + runs-on: ubuntu-latest + needs: verify_commit + if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'false' }} + steps: + - name: Check last workflow status + id: check_status + run: | + workflow_filename="nightly-build.yml" + last_workflow=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/actions/workflows/$workflow_filename/runs?per_page=1" | jq -r '.workflow_runs[0]') + conclusion=$(echo $last_workflow | jq -r '.conclusion') + echo "conclusion=$conclusion" >> $GITHUB_ENV + + - name: Print and handle the status + run: | + echo "The status of the last workflow run is: ${{ env.conclusion }}" + if [ "${{ env.conclusion }}" != "success" ]; then + echo "The last workflow did not succeed. Failing this workflow." + exit 1 + else + echo "The last workflow succeeded. This workflow will succeed." + fi \ No newline at end of file