aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/irc.yml
blob: 7aba3f86ca96a9a38122ae7772517d2c722e87f6 (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
# After every push with successful CI,
# post the commits since the last successful CI into the IRC channel.
name: IRC Post

on:
  workflow_run:
    workflows: ['Continuous Integration']
    types: [completed]
    branches: master

jobs:
  irc:
    runs-on: ubuntu-latest
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    steps:
    - name: Git Clone
      uses: actions/checkout@v4.1.6
    - name: Get last successful commit
      uses: nrwl/last-successful-commit-action@v1
      id: last_successful_commit
      with:
        branch: 'master'
        workflow_id: 'ci.yml'
        github_token: ${{ secrets.GITHUB_TOKEN }}
    - name: Get log
      id: get_log
      run: |
        {
          echo 'LOG<<EOF'
          git log --pretty="format:%h %s" --reverse \
                  ${{ steps.last_successful_commit.outputs.commit_hash }}..HEAD
          echo EOF
        } >> "$GITHUB_OUTPUT"
    - name: Post IRC message
      uses: rectalogic/notify-irc@v1
      with:
        channel: "#sciteco"
        server: "irc.libera.chat"
        nickname: git-bot
        # NOTE: There is also ${{ github.event.ref }} ${{ join(github.event.commits.*.message) }}
        # but it probably doesn't give us the commits since the last succesful one, but simply everything
        # belonging to the push.
        message: ${{ steps.get_log.outputs.LOG }}