-
Notifications
You must be signed in to change notification settings - Fork 4
89 lines (78 loc) · 2.48 KB
/
pr-merge-changelog.yml
File metadata and controls
89 lines (78 loc) · 2.48 KB
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
name: PR Merge Changelog
on:
push:
branches:
- main
paths-ignore:
- CHANGELOG.md
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Check out main
uses: actions/checkout@v4
- name: Find merged PR
id: pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
run: |
python3 .ci-scripts/find_merged_pr.py lookup \
--sha "$COMMIT_SHA" --repo "$REPO"
- name: Set up Python
if: steps.pr.outputs.has_changelog != ''
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Add changelog entry
if: steps.pr.outputs.has_changelog != ''
env:
ENTRY: ${{ steps.pr.outputs.entry }}
BREAKING: ${{ steps.pr.outputs.breaking }}
run: |
if [ -n "$BREAKING" ]; then
python3 .ci-scripts/changelog.py add-entry --breaking "$ENTRY"
else
python3 .ci-scripts/changelog.py add-entry "$ENTRY"
fi
- name: Update skill versions
if: steps.pr.outputs.has_changelog != ''
env:
COMMIT_SHA: ${{ github.sha }}
run: |
python3 .ci-scripts/update_skill_versions.py update --sha "${COMMIT_SHA:0:7}"
- name: Configure git
if: steps.pr.outputs.has_changelog != ''
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit changelog
if: steps.pr.outputs.has_changelog != ''
env:
NUMBER: ${{ steps.pr.outputs.number }}
run: |
git add CHANGELOG.md
if git diff --cached --quiet; then
echo "No changelog changes to commit"
exit 0
fi
git commit -m "Update changelog for PR #${NUMBER}"
- name: Commit skill versions
if: steps.pr.outputs.has_changelog != ''
env:
NUMBER: ${{ steps.pr.outputs.number }}
run: |
git add */SKILL.md
if git diff --cached --quiet; then
echo "No skill version changes to commit"
exit 0
fi
git commit -m "Update skill versions for PR #${NUMBER}"
- name: Push
if: steps.pr.outputs.has_changelog != ''
run: |
git pull --rebase origin main
git push origin main