Repository navigation
78 lines (66 loc) · 2.65 KB
/
Copy pathupdate-docs-changelog.yml
File metadata and controls
78 lines (66 loc) · 2.65 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
name: Update Docs Changelog
on:
# Run weekly on Monday at midnight UTC
schedule:
- cron: '0 0 * * 1'
# Allow manual trigger
workflow_dispatch:
jobs:
update-changelog:
runs-on: ubuntu-latest
# Only run on the main repo, not forks
if: github.repository == 'getsentry/sentry-docs'
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Get auth token
id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
private-key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Update docs changelog
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
run: node scripts/update-docs-changelog.mjs
- name: Check for changes
id: changes
run: |
if git diff --quiet includes/docs-changelog.mdx; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create PR with changes
if: steps.changes.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
run: |
set -euxo pipefail
git config user.email "bot@getsentry.com"
git config user.name "getsentry-bot"
branch="bot/update-docs-changelog-$(date +%Y%m%d)"
git checkout -b "$branch"
git add includes/docs-changelog.mdx
git commit -m "chore: Update docs changelog"
git push --set-upstream origin "$branch" --force
# Check if PR already exists
existing_pr=$(gh pr list --head "$branch" --json number --jq '.[0].number')
if [ -z "$existing_pr" ]; then
gh pr create \
--title "chore: Update docs changelog" \
--body "Automated update of the docs changelog from recent merged PRs."
else
echo "PR #$existing_pr already exists, updated branch"
fi
# Merge with --admin to bypass the review requirement and required
# checks (e.g. lint-404, which flags not-yet-deployed doc links in the
# generated changelog). This file is fully bot-generated, so admin
# merge is safe and matches the pattern used by bump-api-schema-sha.yml.
# Using --auto here instead caused PRs to pile up unmerged, since the
# bot PR never receives the required approving review.
gh pr merge "$branch" --squash --admin --delete-branch