Skip to content

Get new changelog entries #97

Get new changelog entries

Get new changelog entries #97

Workflow file for this run

name: Get new changelog entries
on:
workflow_dispatch:
inputs:
range:
type: number
description: 'Number of days in the date range (default: 8)'
required: false
schedule:
- cron: '0 5 * * 1'
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Get weekly date range
if: github.event.schedule == '0 5 * * 1' || (github.event.inputs.range == null && github.event.schedule != '30 5 1 * *')
run: echo "range=8" >> $GITHUB_ENV
- name: Get input date range
if: github.event.inputs.range != null
run: echo "range=${{ github.event.inputs.range }}" >> $GITHUB_ENV
- name: Get monthly date range
if: github.event.schedule == '30 5 1 * *'
run: echo "range=31" >> $GITHUB_ENV
- name: Get current date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Generate new branch name
run: echo "branch=changelog-${{ env.date }}" >> $GITHUB_ENV
- name: Clone repository
uses: actions/checkout@v3
- name: Create new branch
run: |
git config --global user.email "[email protected]"
git fetch
git checkout master
git branch ${{ env.branch }}
- name: Checkout branch
run: |
git config --global user.email "[email protected]"
git checkout ${{ env.branch }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install Python modules
uses: BSFishy/pip-action@v1
with:
packages: |
requests
pandas
- name: Generate draft changelog files
run: python changelog.py ${{ secrets.GITHUB_TOKEN }} ${{ env.range }}
working-directory: ./scripts/changelog
- name: Check for changes
id: get_changes
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)"
- name: Commit changes
if: steps.get_changes.outputs.changed != 0
run: |
git config --global user.email "[email protected]"
git config --global user.name "Lucie Milan"
git add -A
git commit -am "Automated commit: Create changelog files"
- name: Push changes
if: steps.get_changes.outputs.changed != 0
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.branch }}
- name: Create pull request
if: steps.get_changes.outputs.changed != 0
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.branch }}
destination_branch: "master"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_label: "integration-changelog"
pr_title: Changelog ${{ env.date }}
pr_draft: true
pr_assignee: "lmilan"