forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 2.03 KB
/
weekly-changelog.yml
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
name: "Weekly changelog update"
on:
schedule:
- cron: "45 0 * * 1"
push:
branches:
- master
paths:
- '.github/workflows/weekly-changelog.yml'
jobs:
weekly-changelog:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Get current date"
uses: 1466587594/get-current-time@v2
id: current-date
with:
format: 'YYYYMMDD'
- name: "Get changes since last week"
id: getting-changes
env:
CURR_DATE: ${{ steps.current-date.outputs.formattedTime }}
run: |
LAST_WEEK="$(date -d "@$(( $(date +%s -d $CURR_DATE) - (60*60*24*7) ))" +"%Y-%m-%d")"
tools/generate_changelog.py -f --by-date /tmp/changelog.txt -T "${{ secrets.GITHUB_TOKEN }}" "$LAST_WEEK"
tac /tmp/changelog.txt > /tmp/changelog_rev.txt
tools/merge_summaries.sh /tmp/changelog_rev.txt data/changelog.txt
echo "date=$( date +"%Y-%m-%d" -d $CURR_DATE )" >> $GITHUB_OUTPUT
echo "old_date=$LAST_WEEK" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
commit-message: Weekly Changelog ${{ steps.getting-changes.outputs.old_date }} to ${{ steps.getting-changes.outputs.date }}
committer: David Seguin <[email protected]>
author: David Seguin <[email protected]>
token: ${{ secrets.TX_PR_CREATOR }}
branch: changelog-weekly-${{ steps.getting-changes.outputs.date }}
delete-branch: true
base: master
title: Weekly Changelog ${{ steps.getting-changes.outputs.old_date }} to ${{ steps.getting-changes.outputs.date }}
body: "#### Summary\nNone\n\n#### Additional context\n`Automatically generated as a draft. Please copy-edit before merging.`"
labels: Organization,<Documentation>
# create as a draft to allow maintainers to cull the changes before merging
draft: true