commit message #13
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: CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set DATE environment variable | |
run: echo "DATE=$(TZ='Asia/Shanghai' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV | |
# 其他步骤... | |
- name: Translate job status to Chinese | |
id: translate-status | |
run: | | |
if [ "${{ job.status }}" == "success" ]; then | |
echo "translated_status=成功" >> $GITHUB_ENV | |
elif [ "${{ job.status }}" == "failure" ]; then | |
echo "translated_status=失败" >> $GITHUB_ENV | |
elif [ "${{ job.status }}" == "cancelled" ]; then | |
echo "translated_status=取消" >> $GITHUB_ENV | |
else | |
echo "translated_status=未知" >> $GITHUB_ENV | |
fi | |
- name: Notify job status | |
if: always() # 确保这一步始终运行,不管之前的步骤是否成功 | |
run: | | |
curl -X "POST" "${{ secrets.BARK_KEY }}" \ | |
-H 'Content-Type: application/json; charset=utf-8' \ | |
-d '{ | |
"body": "${{ github.repository }}于${{ env.DATE }}运行${{ env.translated_status }}", | |
"title": "Github Actions", | |
"badge": 1, | |
"category": "Github Actions", | |
"sound": "multiwayinvitation.caf", | |
"icon": "https://cdn.pixabay.com/photo/2022/01/30/13/33/github-6980894_1280.png", | |
"group": "Github Actions" | |
}' |