Read this in other languages: English, 日本語.
GitHub actions to get git comment.
Details
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]')"
payload.head_commit.message
-
git log --format=%B {{ sha }}
e.g.
test1 test2 test3
-
Split at line break
e.g.
['test1 test2', '', 'test3']
-
Trim and filter
e.g.
['test1 test2', 'test3']
-
Combine by
SEPARATOR
optione.g.
test1 test2 test3
- sha
- context.payload.pull_request.head.sha
- context.payload.deployment.sha
- context.sha
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.