Home > Development Tools > git > how to get commit message in github actions

how to get commit message in github actions

Susan Sarandon
Release: 2024-10-10 11:53:13
Original
582 people have browsed it

GitHub Actions enable access to the commit message via the 'github.event.head_commit.message' property, providing the entire message with title and body. Developers can retrieve the message using this property or through the 'GITHUB_HEAD_COMMIT_MESSA

how to get commit message in github actions

How to get commit message in github actions

In GitHub Actions, you can access the commit message using the github.event.head_commit.message property. This property contains the full commit message, including the title and body.

How do I retrieve the commit message within a GitHub action?

To retrieve the commit message within a GitHub action, you can use the following syntax:

<code>echo "${{ github.event.head_commit.message }}"</code>
Copy after login

This will output the commit message to the console.

Is there a way to access the commit message in a GitHub action workflow?

Yes, you can access the commit message in a GitHub action workflow using the env property. The env property contains a list of environment variables that are available to your workflow. The commit message is available as the GITHUB_HEAD_COMMIT_MESSAGE environment variable.

To access the commit message using the env property, you can use the following syntax:

<code>echo "${{ env.GITHUB_HEAD_COMMIT_MESSAGE }}"</code>
Copy after login

This will output the commit message to the console.

The above is the detailed content of how to get commit message in github actions. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template