blob: 8ed06ef89dc304568253ba57e8829d6bae614caf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
name: Weekly Changelog Update
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at 00:00
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
jobs:
gather-branches:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.branch-list.outputs.branches }}
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: List 'main' and 'stable-*' branches
id: branch-list
run: |
git fetch --all
BRANCHES=$(git branch -r | grep -E "origin/(main|stable-25(-[0-9]+)*)$" | grep -v HEAD | sed "s/origin\///" | xargs | tr -d '\n' | jq -R -s -c "split(\" \")")
echo "::notice:: BRANCHES $BRANCHES"
if [ -z "$BRANCHES" ]; then
BRANCHES="[]"
fi
echo "$BRANCHES" > branches.json
echo "branches=$BRANCHES" >> "$GITHUB_OUTPUT"
gather-prs:
runs-on: ubuntu-latest
needs: gather-branches
strategy:
fail-fast: false
matrix:
branch: ${{ fromJson(needs.gather-branches.outputs.branches) }}
outputs:
prs: ${{ steps.pr-list.outputs.prs }}
base_branch: ${{ steps.branch-name.outputs.base_branch }}
steps:
- name: Check out repository
uses: actions/checkout@v5
with:
ref: ${{ github.ref }}
- name: Set up date range
id: date-setup
run: |
LAST_WEEK_DATE=$(date -d "7 days ago" '+%Y-%m-%dT%H:%M:%SZ')
echo "LAST_WEEK_DATE=$LAST_WEEK_DATE" >> $GITHUB_ENV
- name: Get merged PRs
id: pr-list
run: |
REF_NAME=${{ matrix.branch }}
echo "::notice:: branch = $REF_NAME, date = $LAST_WEEK_DATE"
PRS=$(gh pr list -L 1000 --state merged --json number,title,baseRefName,mergedAt --jq ".[] | select(.baseRefName == \"$REF_NAME\" and .mergedAt >= \"$LAST_WEEK_DATE\") | {id: .number}" | jq -c -s ".")
if [ -z "$PRS" ]; then
PRS="[]"
fi
echo "$PRS" > prs-${{ matrix.branch }}.json
echo "PRS=$PRS" >> $GITHUB_ENV
echo "prs=$PRS" >> "$GITHUB_OUTPUT"
- name: Debug PR list output
run: |
cat prs-${{ matrix.branch }}.json
- name: Upload PRs JSON
uses: actions/upload-artifact@v6
with:
name: prs-json-${{ matrix.branch }}
path: prs-${{ matrix.branch }}.json
- name: Get current date
id: get-date
shell: bash
run: echo "suffix=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Update Changelog
uses: ./.github/actions/update_changelog
env:
GH_TOKEN: ${{ secrets.YDBOT_TOKEN }}
with:
pr_data: ${{ steps.pr-list.outputs.prs }}
changelog_path: "./CHANGELOG.md"
base_branch: "${{ matrix.branch }}"
suffix: "${{ env.suffix }}"
|