diff --git a/.github/workflows/list_workflow_last_run.yml b/.github/workflows/list_workflow_last_run.yml new file mode 100644 index 00000000000..cb826948901 --- /dev/null +++ b/.github/workflows/list_workflow_last_run.yml @@ -0,0 +1,43 @@ + name: List workflow last run + on: + workflow_dispatch: + schedule: + - cron: "0 10 * * 1" + env: + GH_TOKEN: ${{ github.token }} + jobs: + list_workflow: + runs-on: ubuntu-latest + outputs: + messages: ${{ steps.cat_output.outputs.message }} + steps: + - name: checkout + uses: actions/checkout@v3 + - name: run script + run: | + chmod +x ./Scripts/developer_scripts/list_cgal_workflows_last_run.sh + ./Scripts/developer_scripts/list_cgal_workflows_last_run.sh > output.md + - name: convert markdown to html + run: | + sudo apt-get update && sudo apt-get install -y pandoc + pandoc -f markdown -t html -o output.html output.md + - name: set_output + id: cat_output + run: | + delimiter="$(openssl rand -hex 8)" + echo "message<<${delimiter}" >> "${GITHUB_OUTPUT}" + echo "Subject:List workflow run \nContent-Type: text/html\n" >> "${GITHUB_OUTPUT}" + echo "" >> "${GITHUB_OUTPUT}" + cat output.html >> "${GITHUB_OUTPUT}" + echo "" >> "${GITHUB_OUTPUT}" + echo "${delimiter}" >> "${GITHUB_OUTPUT}" + call_send_email: + needs: list_workflow + uses: ./.github/workflows/send_email.yml + with: + message: ${{needs.list_workflow.outputs.messages}} + secrets: + email: ${{ secrets.CGAL_SEND_WORKFLOW_LIST_EMAIL_TO }} + private_key: ${{ secrets.CGAL_SEND_WORKFLOW_LIST_EMAIL_SSH_PRIVATE_KEY }} + user: ${{ secrets.CGAL_SEND_WORKFLOW_LIST_EMAIL_SSH_USER }} + host: ${{ secrets.CGAL_SEND_WORKFLOW_LIST_EMAIL_SSH_HOST }} \ No newline at end of file diff --git a/.github/workflows/send_email.yml b/.github/workflows/send_email.yml index 11acfa9878a..cb990eca146 100644 --- a/.github/workflows/send_email.yml +++ b/.github/workflows/send_email.yml @@ -28,4 +28,4 @@ jobs: ssh-keyscan -H ${{ secrets.host }} > ~/.ssh/known_hosts - name: send email via ssh run: | - echo "${{ inputs.message }}" | ssh ${{ secrets.user }}@${{ secrets.host }} "/sbin/sendmail -t ${{ secrets.email }}" + echo -e '${{ inputs.message }}' | ssh ${{ secrets.user }}@${{ secrets.host }} "/sbin/sendmail -t ${{ secrets.email }}" diff --git a/Scripts/developer_scripts/list_cgal_workflows_last_run.sh b/Scripts/developer_scripts/list_cgal_workflows_last_run.sh new file mode 100644 index 00000000000..e3d830bf15d --- /dev/null +++ b/Scripts/developer_scripts/list_cgal_workflows_last_run.sh @@ -0,0 +1,73 @@ +#!/bin/bash +echo "| repo | workflow | branch | event | runs on | status of last run | state | annotation | date | date since last runs | file |" +echo "| :--: | :--------: | :----: | :---: | :------: | :------------------: | :---: | :--------: | :----: | :------------------: | :----: |" +actualdate=$EPOCHSECONDS +for repo in $(gh api orgs/CGAL/repos --jq '.[].full_name' | grep -v dev ) +do + if [ "$repo" != "CGAL/CNRS" ] && [ "$repo" != "CGAL/GeometryFactory" ] + then + default_branch=$(gh api repos/$repo --jq '.default_branch') + workflows=$(gh api repos/$repo/actions/workflows) + workflows_count=$(jq '.total_count' <<< "$workflows") + for ((i=0;i