更新 .gitea/workflows/demo.yaml
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 45s Details

添加合并请求,合并完的状态触发信息,发布生产
This commit is contained in:
xiehaijun 2025-07-26 16:47:19 +00:00
parent f0b837390a
commit 77efce977d
1 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,9 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
pull_request:
branches: ["main"]
types: [closed] # 当pull request被合并或关闭时触发。这包括两种情况一是pull request被合并merged二是pull request被直接关闭closed
push:
branches: [ "main","releases/**" ]
# paths:
@ -46,6 +49,18 @@ jobs:
echo "不包含"
exit 1
fi
- name: Get commit message (Pull Request)
if: github.event_name == 'pull_request'
run: |
echo "是否是合并关闭的 $PR_STATUS_FLAG"
pr_num=${{ github.event.pull_request.number }}
git fetch origin refs/pull/${pr_num}/head:refs/remotes/origin/pull/${pr_num}/head
commit_title=$(git log -1 --pretty=format:"%s" origin/pull/${pr_num}/head)
commit_body=$(git log -1 --pretty=format:"%b" origin/pull/${pr_num}/head)
echo "合并请求 Commit Title: $commit_title"
echo "合并请求Commit Body: $commit_body"
env:
PR_STATUS_FLAG: ${{ github.event.pull_request.merged }}
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"