docs: Add tips in doc #26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Changelog | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
name: Generate and Commit Changelog | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Generate Changelog | |
uses: smichard/[email protected] | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Git User Info | |
run: | | |
git config user.name 'GitHub Actions Bot' | |
git config user.email '[email protected]' | |
- run: | | |
sudo chmod -R ugo+rwX . | |
- name: Commit Changelog | |
run: | | |
git add CHANGELOG.md | |
git commit -m "docs: :robot: changelog file generated" || echo "No changes to commit" | |
git push | |
add-comment: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get all commits on this push | |
id: get_commits | |
run: | | |
# 获取所有提交的日志 | |
commits=$(git log --format="%H %s" ${{ github.event.before }}..${{ github.sha }}) | |
echo "$commits" | |
# 将提交信息设置为输出 | |
echo "::set-output name=commits::$commits" | |
- name: Add comment | |
run: gh issue comment "$NUMBER" --body "$BODY" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
NUMBER: 10 | |
BODY: > | |
## New Push | |
### Commits | |
``` | |
${{ steps.get_commits.outputs.commits }} | |
``` | |
> *I am a robot and this action was performed automatically.* |