summaryrefslogtreecommitdiff
path: root/.forgejo/workflows/emails.yml
blob: 115f70de524adde049d2ae4a82bb4dc9f6df8a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: emails

on:
  push:
    branches: [dev]
  pull_request:
    branches: [dev]

defaults:
  run:
    shell: bash

env:
  REPO_OWNER: "gentoo"
  REPO_NAME: "guru"
  REPO_WORKFLOW: "emails.yml"
  IRC_NICK: "guru-ci"
  IRC_HOST: "irc.libera.chat"
  IRC_PORT: "6697"
  IRC_CHANNEL: "#gentoo-guru"

jobs:
  bugzilla:
    runs-on: codeberg-tiny-lazy
    steps:
      - name: Checkout repo
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Get compare commit
        run: |
          COMMIT=$(python ./scripts/last_successful_commit.py)
          echo "last_successful_commit=${COMMIT}" >> "${FORGEJO_ENV}"
          echo "Last successful commit: ${COMMIT}"
          if git rev-parse --verify "${COMMIT}^{commit}" > /dev/null; then
            echo -e "\033[92m\u2713 ${COMMIT:0:7} points to a valid commit"
            VALID=true
          else
            echo -e "\033[91m\u2717 ${COMMIT:0:7} doesn't point to a valid commit"
            VALID=false
          fi
          echo "is_commit_valid=${VALID}" >> "${FORGEJO_ENV}"

      - name: Get changed files
        if: ${{ fromJSON(env.is_commit_valid) }}
        run: |
          git diff --diff-filter d --name-only ${last_successful_commit} -- '*/metadata.xml' | tr '\n' ' ' | tee all_changed_files.txt

      - name: Check emails against Bugzilla
        if: ${{ fromJSON(env.is_commit_valid) }}
        run: |
          python ./scripts/email-checker.py < all_changed_files.txt

      - name: Inform on IRC
        if: ${{ failure() && forgejo.repository == 'gentoo/guru' && forgejo.event_name == 'push' }}
        run: |
          python ./scripts/irc_notify.py
        env:
          IRC_MESSAGE: CI failure detected on job ${{ forgejo.workflow }} - ${{ forgejo.server_url }}/${{ forgejo.repository }}/actions/runs/${{ forgejo.run_number }}