Skip to content

Commit 7301fee

Browse files
committed
chore: require Redocly config update before release
1 parent a75ef9d commit 7301fee

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/pre-release.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Pre-release Checks
2+
3+
permissions:
4+
contents: read
5+
pull-requests: write
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- main
11+
12+
env:
13+
CI: true
14+
REDOCLY_TELEMETRY: off
15+
16+
jobs:
17+
checks:
18+
# Run only on release branch (changeset-release/main):
19+
if: github.head_ref == 'changeset-release/main'
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 24
26+
cache: npm
27+
- name: Check Redocly Config Version
28+
run: |
29+
LATEST_VERSION=$(npm view @redocly/config version)
30+
CURRENT_VERSION=$(jq -r '.dependencies["@redocly/config"] | ltrimstr("^") | ltrimstr("~")' packages/core/package.json)
31+
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
32+
COMMENT="⚠️ **Redocly Config version mismatch**: The latest published version of \`@redocly/config\` is \`$LATEST_VERSION\`, but the current version is \`$CURRENT_VERSION\`. Please consider updating to the latest version."
33+
echo "$COMMENT"
34+
gh pr comment $PR_NUMBER --body "$COMMENT"
35+
exit 1
36+
else
37+
echo "Redocly Config version is up to date: $CURRENT_VERSION"
38+
fi
39+
env:
40+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
PR_NUMBER: ${{ github.event.pull_request.number }}

0 commit comments

Comments
 (0)