Auto-ChangeLog #7
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: | |
- Beta | |
- V1.0.0 | |
- backup-branch | |
pull_request: | |
branches: | |
- Beta | |
- V1.0.0 | |
- backup-branch | |
release: | |
types: [published] | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Install dependencies | |
run: npm install | |
- name: Set Git config | |
run: | | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "[email protected]" | |
- name: Generate Changelog | |
run: npm run release | |
- name: Check if there are changes to commit | |
run: | | |
git status --porcelain | grep "CHANGELOG.md\|package.json" || echo "No changes to commit" | |
- name: Check token availability | |
run: | | |
echo "Token is available: ${{ secrets.GH_TOKEN }}" || echo "GH_TOKEN not set" | |
- name: Commit and push changes if necessary | |
run: | | |
git add CHANGELOG.md package.json | |
git status --porcelain | grep "CHANGELOG.md\|package.json" && git commit -m "chore(release): update changelog and version" | |
git push https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git HEAD:${{ github.ref }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |