Skip to content

Get git comment action

Actions
GitHub actions to get git comment
v1.2.3
Latest
Star (1)

Tags

 (1)

Get git comment action

CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

GitHub actions to get git comment.

Table of Contents

Details

Screenshots

Skip CI

skip ci

Not skip CI

not skip ci

Usage

e.g.

on:
  pull_request:
  push:
    branches:
      - main
    tags:
      - "!*"
name: CI
jobs:
  eslint:
    name: Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: technote-space/get-git-comment-action@v1
      - name: Install Package dependencies
        run: yarn install
        if: "! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"
      - name: Check code style
        run: yarn test
        if: "! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"

Outputs

message

if eventName == push

payload.head_commit.message

else

  1. git log --format=%B {{ sha }}

    e.g.

    test1 test2  
    
    test3
    
  2. Split at line break

    e.g.

    ['test1 test2', '', 'test3']
    
  3. Trim and filter

    e.g.

    ['test1 test2', 'test3']
    
  4. Combine by SEPARATOR option

    e.g.

    test1 test2 test3
    
  • sha
    1. context.payload.pull_request.head.sha
    2. context.payload.deployment.sha
    3. context.sha

Why?

head_commit.message is often introduced as a way to implement [ci skip], but of course it cannot be used in pull_request events.
By using this action, you can get comments other than push event.

Author

GitHub (Technote)
Blog

Get git comment action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

GitHub actions to get git comment
v1.2.3
Latest

Tags

 (1)

Get git comment action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.