diff --git a/.github/actions/.gitkeep b/.github/actions/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/actions/notify/action.yml b/.github/actions/notify/action.yml new file mode 100644 index 00000000..f04db3b1 --- /dev/null +++ b/.github/actions/notify/action.yml @@ -0,0 +1,26 @@ +name: Define notification message +description: Identify an appropriate notification message. +branding: + icon: 'message-square' + color: 'green' +outputs: + txt: + description: The message. + value: ${{ steps.message.outputs.txt }} +runs: + using: composite + steps: + - name: Define notification message + id: message + run: | + if [ -n "${{ github.event.head_commit.message }}" ] + then + echo txt="${{ github.event.head_commit.message }}" >> $GITHUB_OUTPUT + elif [ -n "${{ github.event.schedule }}" ] + then + echo txt="regular healthcheck" >> $GITHUB_OUTPUT + elif [ -n "${{ github.event.inputs.reason }}" ] + then + echo txt="${{ github.event.inputs.reason }}" >> $GITHUB_OUTPUT + fi + shell: bash diff --git a/.github/workflows/caches.yml b/.github/workflows/caches.yml index 62c899f6..1d8c0d4d 100644 --- a/.github/workflows/caches.yml +++ b/.github/workflows/caches.yml @@ -2,6 +2,11 @@ name: Cache invalidation on: workflow_dispatch: + inputs: + reason: + type: string + default: manual healthcheck + required: true schedule: - name: At 06:00 on Sunday, UTC @@ -41,11 +46,20 @@ jobs: if: failure() || success() steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} SLACK_TITLE: '🧹 ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8f9f445..a63d0a38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,20 +2,25 @@ name: Continuous integration on: workflow_dispatch: + inputs: + reason: + type: string + default: manual healthcheck + required: true pull_request: branches: [ main ] paths: - - .github/workflows/ci.yml - - package*.json + - '.github/workflows/ci.yml' + - 'package*.json' - '**.jsx?' - '**.tsx?' push: branches: [ main ] paths: - - .github/workflows/ci.yml - - package*.json + - '.github/workflows/ci.yml' + - 'package*.json' - '**.jsx?' - '**.tsx?' tags: [ '!*' ] @@ -66,11 +71,20 @@ jobs: if: github.event_name != 'pull_request' && (failure() || success()) steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} SLACK_TITLE: '⚙️ ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/deps.yml b/.github/workflows/deps.yml index a5ce6172..13ea4394 100644 --- a/.github/workflows/deps.yml +++ b/.github/workflows/deps.yml @@ -2,6 +2,11 @@ name: Dependabot at weekends on: workflow_dispatch: + inputs: + reason: + type: string + default: manual healthcheck + required: true schedule: - name: At 06:00 on Saturday and Sunday, UTC @@ -37,11 +42,20 @@ jobs: if: failure() || success() steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} SLACK_TITLE: '🤖 ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 67a8db57..65d6502a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -2,6 +2,11 @@ name: Documentation delivery on: workflow_dispatch: + inputs: + reason: + type: string + default: manual healthcheck + required: true push: branches: [ main ] @@ -47,11 +52,20 @@ jobs: if: failure() || success() steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} SLACK_TITLE: '📚 ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/runs.yml b/.github/workflows/runs.yml index 54546361..8c5ab100 100644 --- a/.github/workflows/runs.yml +++ b/.github/workflows/runs.yml @@ -21,6 +21,10 @@ on: description: Only log actions, do not perform any delete operations. type: boolean required: false + reason: + type: string + default: manual healthcheck + required: true jobs: delete: @@ -45,11 +49,20 @@ jobs: if: failure() || success() steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + - name: Send Slack notification uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} SLACK_TITLE: '🗑️ ${{ github.repository }}: ${{ github.workflow }}' SLACK_USERNAME: GitHub Actions SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 064a02a3..06f3caa6 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -2,6 +2,11 @@ name: Issue invalidation on: workflow_dispatch: + inputs: + reason: + type: string + default: manual healthcheck + required: true schedule: - name: At 06:00 every day, UTC @@ -46,3 +51,28 @@ jobs: close-pr-message: > This pull request was closed because it has been stalled for 7 days with no activity. delete-branch: true + + notify: + name: Notifying + needs: [ check ] + runs-on: ubuntu-latest + if: failure() || success() + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: { fetch-depth: 0 } + - name: Define notification message + id: message + uses: ./.github/actions/notify + + - name: Send Slack notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }} + SLACK_FOOTER: made with ❤️ for everyone, OctoLab + SLACK_ICON: https://github.com/github.png?size=64 + SLACK_MESSAGE: ${{ steps.message.outputs.txt }} + SLACK_TITLE: '⚠️ ${{ github.repository }}: ${{ github.workflow }}' + SLACK_USERNAME: GitHub Actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}