Automate Release Notes Creation #10
Workflow file for this run
This file contains hidden or 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 Release Notes | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| pull_request: | |
| branches: | |
| - '**' | |
| jobs: | |
| generate-release-notes: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: anupriya13/react-native-windows | |
| fetch-depth: 0 | |
| # For push events, github.ref_name is the branch | |
| # For PR events, github.head_ref is the source branch of PR | |
| ref: ${{ github.head_ref != '' && github.head_ref || github.ref_name }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.11.12 | |
| - name: Install dependencies | |
| run: pip install requests | |
| - name: Generate release notes file | |
| run: | | |
| python .github/scripts/generate_release_notes.py > release_notes.md | |
| mkdir -p .github/release_notes | |
| mv release_notes.md .github/release_notes/release_notes.md | |
| - name: Commit and push release notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .github/release_notes/release_notes.md | |
| git diff --cached --quiet || git commit -m "Add generated release notes" | |
| # Push only if on a branch (not on tags or detached head) | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| git push origin HEAD:${{ github.head_ref }} | |
| else | |
| git push origin HEAD:${{ github.ref_name }} | |
| fi |