将README和LICENSE复制到模块压缩包内 #18
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: CRLF To LF | |
on: | |
push: | |
branches: | |
- 'main' | |
env: | |
GITHUB_USER: "${{secrets.USERNAME}}" | |
GITHUB_EMAIL: "${{secrets.EMAIL}}" | |
GITHUB_TOKEN: "${{secrets.API_TOKEN_GITHUB}}" | |
GIT_CLONE: "${{ github.workspace }}/git_clone" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
- name: Install tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y dos2unix ssh git | |
- name: CRLF to LF | |
run: | | |
git config --global user.name "${GITHUB_USER}" | |
git config --global user.email "${GITHUB_EMAIL}" | |
mkdir -vp ${GIT_CLONE} | |
git clone https://"${GITHUB_USER}":"${GITHUB_TOKEN}"@github.com/chase535/accurate_battery.git ${GIT_CLONE} -b main --depth=1 | |
cd ${GIT_CLONE} | |
files=$(find . -type f -not -path "./.git/*") | |
dos2unix ${files} | |
if [ -n "$(git diff)" ]; then | |
git add . -f | |
git commit -a -m "换行符CRLF转LF" | |
git push origin main -f | |
fi |