[ docs ] Update auto-readme.yaml #10
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: Update README with Commit Info | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Get latest commit info | |
id: commit_info | |
run: | | |
COMMIT_HASH=$(git log -1 --format="%H") | |
COMMIT_MSG=$(git log -1 --format="%s") | |
COMMIT_DATE=$(git log -1 --format="%Y-%m-%d %H:%M:%S") | |
echo "::set-output name=hash::$COMMIT_HASH" | |
echo "::set-output name=msg::$COMMIT_MSG" | |
echo "::set-output name=date::$COMMIT_DATE" | |
- name: Update README | |
run: | | |
echo "## Latest Commit" > README.md | |
echo "- **Commit Hash**: ${{ steps.commit_info.outputs.hash }}" >> README.md | |
echo "- **Message**: ${{ steps.commit_info.outputs.msg }}" >> README.md | |
echo "- **Date**: ${{ steps.commit_info.outputs.date }}" >> README.md | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.name 'eunbeann' | |
git config --global user.email '[email protected]' | |
git add README.md | |
git commit -m "[ docs ] Update README" | |
git push |