How to write a multiline commit_message #279
-
For example, I have a yml, similar to this form: name: "test"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Update 1
run: |
sed -i "8c PKG_VERSION:=1.1" Makefile
cd
echo "Version Update Title" >> commitmessage.txt
- name: Update 1
run: |
sed -i "8c PKG_VERSION:=1.1" Makefile
cd
echo "Makefile version update 1.1" >> commitmessage.txt
- name: Update 2
run: |
sed -i "12c PKG_VERSION:=1.2" Makefile
cd
echo "Makefile version update 1.2" >> commitmessage.txt
- name: Git Auto Commit
uses: stefanzweifel/[email protected]
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: ./commitmessage.txt
branch: packages Is it possible to put a multi-line commit message into a file, and then assign the content of this file to commit_message, so as to realize a multi-line commit message. But I tried it, but it doesn't seem to work. Is there any way to achieve a multi-line commit message? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
The value passed to name: "test"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@main
- name: Update 1
run: |
sed -i "8c PKG_VERSION:=1.1" Makefile
cd
echo "Version Update Title" >> commitmessage.txt
- name: Update 1
run: |
sed -i "8c PKG_VERSION:=1.1" Makefile
cd
echo "Makefile version update 1.1" >> commitmessage.txt
- name: Update 2
run: |
sed -i "12c PKG_VERSION:=1.2" Makefile
cd
echo "Makefile version update 1.2" >> commitmessage.txt
+ - name: Read Commit Message
+ id: commit_message_step
+ run: |
+ echo "commit_message=$(cat commitmessage.txt)" >> $GITHUB_OUTPUT;
- name: Git Auto Commit
uses: stefanzweifel/[email protected]
id: commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
- commit_message: ./commitmessage.txt
+ commit_message: ${{ steps.commit_message_step.outputs.commit_message }}
branch: packages The "Read Commit Message"-step outputs the value of The commit step is then updated to use the |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
This is working for me with a used github actions. Probably this way will work here too
|
Beta Was this translation helpful? Give feedback.
The value passed to
commit_message
must be a string. Actions isn't clever enough to see that you're referencing a file here.I haven't tested the workflow below, but it should technically work:
(Added a test to cover this.)