@diplodoc/client 5.8.0 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,8 +19,9 @@
19
19
  # commit on the PR was authored AND committed by yc-ui-bot (mirrors
20
20
  # commitsAllAuthoredBy() in scripts/match-auto-approve.js).
21
21
  # - On every push (synchronize) any prior bot approval made for an older commit
22
- # is DISMISSED, so an approval never lingers over unreviewed new code. A fresh
23
- # approval is only re-issued when the new head is still all-bot content.
22
+ # is DISMISSED and the workflow stops no immediate re-approve. A fresh
23
+ # approval is issued only after other PR workflows finish and all non-excluded
24
+ # checks on the new head are green (workflow_run trigger).
24
25
  #
25
26
  # To opt a repo out, exclude this file via .infrarc.yml or distribution.yml.
26
27
 
@@ -29,9 +30,15 @@ name: Auto-approve bot PRs
29
30
  on:
30
31
  pull_request:
31
32
  types: [opened, reopened, synchronize, ready_for_review]
33
+ # After a force-push we only dismiss stale approvals on `synchronize` (below).
34
+ # Re-approve once the other PR workflows finish and all non-excluded checks are
35
+ # green — so an approval never covers unreviewed new code while CI is pending.
36
+ workflow_run:
37
+ types: [completed]
32
38
 
33
39
  permissions:
34
40
  contents: read
41
+ checks: read
35
42
 
36
43
  jobs:
37
44
  auto-approve:
@@ -41,9 +48,14 @@ jobs:
41
48
  # (For fork PRs GitHub does not expose secrets, so HAS_PAT is false and the
42
49
  # step below is skipped — fork PRs can never be auto-approved.)
43
50
  if: >
44
- github.event.pull_request.user.login == 'yc-ui-bot' &&
45
- (startsWith(github.event.pull_request.head.ref, 'ci/update-deps/') ||
46
- startsWith(github.event.pull_request.head.ref, 'release-please--'))
51
+ (github.event_name == 'pull_request' &&
52
+ github.event.pull_request.user.login == 'yc-ui-bot' &&
53
+ (startsWith(github.event.pull_request.head.ref, 'ci/update-deps/') ||
54
+ startsWith(github.event.pull_request.head.ref, 'release-please--'))) ||
55
+ (github.event_name == 'workflow_run' &&
56
+ github.event.workflow_run.name != 'Auto-approve bot PRs' &&
57
+ (startsWith(github.event.workflow_run.head_branch, 'ci/update-deps/') ||
58
+ startsWith(github.event.workflow_run.head_branch, 'release-please--')))
47
59
  env:
48
60
  # `secrets` is not available in a step-level `if`; map to a job-level env
49
61
  # flag (which can read secrets) so we can skip cleanly when the PAT is unset.
@@ -59,12 +71,69 @@ jobs:
59
71
  script: |
60
72
  // The only identity whose automated commits we trust to auto-approve.
61
73
  const ALLOWED_AUTHOR = 'yc-ui-bot';
74
+ // Keep in sync with ci_gate.exclude_checks in distribution.yml.
75
+ const SKIP_CHECK_RE = /^(auto-approve|release-please|dependabot|update dependenc|distribute|publish|sonarcloud)/i;
62
76
 
63
77
  const {owner, repo} = context.repo;
64
- const pr = context.payload.pull_request;
65
- const prNumber = pr.number;
66
- const headSha = pr.head.sha;
67
- const prAuthor = pr.user.login;
78
+ let pr;
79
+ let prNumber;
80
+ let headSha;
81
+ let prAuthor;
82
+ let isSynchronize = false;
83
+
84
+ if (context.eventName === 'workflow_run') {
85
+ const wr = context.payload.workflow_run;
86
+ if (wr.conclusion !== 'success' && wr.conclusion !== 'skipped') {
87
+ core.notice(`Workflow "${wr.name}" concluded ${wr.conclusion} — skip re-approve.`);
88
+ return;
89
+ }
90
+ const branch = wr.head_branch;
91
+ const {data: prs} = await github.rest.pulls.list({
92
+ owner, repo, state: 'open', head: `${owner}:${branch}`, per_page: 2,
93
+ });
94
+ if (prs.length !== 1) {
95
+ core.notice(`Expected 1 open PR for ${branch}, found ${prs.length} — skip.`);
96
+ return;
97
+ }
98
+ pr = prs[0];
99
+ if (!pr.user || pr.user.login !== ALLOWED_AUTHOR) {
100
+ core.notice('Open PR author is not the trusted bot — skip.');
101
+ return;
102
+ }
103
+ prNumber = pr.number;
104
+ headSha = pr.head.sha;
105
+ prAuthor = pr.user.login;
106
+ if (wr.head_sha !== headSha) {
107
+ core.notice(`Workflow run SHA ${wr.head_sha} != PR head ${headSha} — skip.`);
108
+ return;
109
+ }
110
+
111
+ const checkRuns = await github.paginate(github.rest.checks.listForRef, {
112
+ owner, repo, ref: headSha, per_page: 100,
113
+ });
114
+ const relevant = checkRuns.filter((r) => r.name && !SKIP_CHECK_RE.test(r.name));
115
+ if (relevant.length === 0) {
116
+ core.notice('No relevant check runs yet — skip re-approve.');
117
+ return;
118
+ }
119
+ if (relevant.some((r) => r.status !== 'completed')) {
120
+ core.notice('CI still in progress — skip re-approve.');
121
+ return;
122
+ }
123
+ const bad = relevant.filter(
124
+ (r) => !['success', 'skipped', 'neutral'].includes(r.conclusion || ''),
125
+ );
126
+ if (bad.length) {
127
+ core.notice(`Failing checks: ${bad.map((r) => r.name).join(', ')} — skip.`);
128
+ return;
129
+ }
130
+ } else {
131
+ pr = context.payload.pull_request;
132
+ prNumber = pr.number;
133
+ headSha = pr.head.sha;
134
+ prAuthor = pr.user.login;
135
+ isSynchronize = context.payload.action === 'synchronize';
136
+ }
68
137
 
69
138
  // Resolve the approver (this PAT's identity).
70
139
  let approver = '';
@@ -135,6 +204,13 @@ jobs:
135
204
  return;
136
205
  }
137
206
 
207
+ // On push: invalidate stale bot approvals and stop. Re-approve only
208
+ // after CI completes (workflow_run trigger above).
209
+ if (isSynchronize) {
210
+ core.notice(`PR #${prNumber}: stale approvals dismissed; waiting for CI before re-approve.`);
211
+ return;
212
+ }
213
+
138
214
  // Idempotent: skip if we already approved the current head.
139
215
  if (botApprovals.some((r) => r.commit_id === headSha)) {
140
216
  core.notice(`PR #${prNumber} already approved for current head — nothing to do.`);
@@ -55,7 +55,16 @@ jobs:
55
55
  git config --global user.email "95919151+yc-ui-bot@users.noreply.github.com"
56
56
  git config --global user.name "yc-ui-bot"
57
57
 
58
- # Commit and push
59
58
  git add package-lock.json
60
- git commit -m "chore: Update package-lock.json" --no-verify
61
- git push origin HEAD:${BRANCH_NAME}
59
+ git fetch origin "${BRANCH_NAME}"
60
+ REMOTE_TIP="$(git rev-parse "origin/${BRANCH_NAME}")"
61
+
62
+ git commit --amend --no-edit --no-verify
63
+ if git push --force-with-lease origin "HEAD:${BRANCH_NAME}"; then
64
+ echo "::notice::Pushed amended lockfile commit on ${BRANCH_NAME}"
65
+ else
66
+ echo "::warning::Force-push failed, falling back to a regular commit"
67
+ git reset --soft "${REMOTE_TIP}"
68
+ git commit -m "chore: Update package-lock.json" --no-verify
69
+ git push origin "HEAD:${BRANCH_NAME}"
70
+ fi
@@ -10,6 +10,22 @@ name: Release Package to npm
10
10
  # - Prerelease: triggered by manual dispatch with 'prerelease' type (only from non-protected branches)
11
11
  # - Deprecate: triggered by manual dispatch with 'deprecate' type (marks a version as deprecated)
12
12
 
13
+ # GitHub auto-generates a run-name from event data when run-name is not set
14
+ # explicitly (e.g. it uses the release tag_name for `release` events, which is
15
+ # why runs triggered by the `release` event show "vX.XX.XX" instead of the
16
+ # workflow name). workflow_dispatch events carry no such default, so without an
17
+ # explicit run-name every manual run (prerelease/deprecate) just shows the
18
+ # workflow name. The run-name below makes all trigger types display something
19
+ # meaningful in the Actions history.
20
+ run-name: >-
21
+ ${{
22
+ github.event_name == 'release' && format('Release: {0}', github.event.release.tag_name)
23
+ || (github.event_name == 'workflow_dispatch' && inputs.release_type == 'deprecate' && inputs.deprecate_new_latest != '' && format('Deprecate: {0} -> {1}', inputs.deprecate_version, inputs.deprecate_new_latest))
24
+ || (github.event_name == 'workflow_dispatch' && inputs.release_type == 'deprecate' && format('Deprecate: {0}', inputs.deprecate_version))
25
+ || (github.event_name == 'workflow_dispatch' && inputs.release_type == 'prerelease' && format('Prerelease: {0}', github.ref_name))
26
+ || github.workflow
27
+ }}
28
+
13
29
  on:
14
30
  release:
15
31
  types: [published]
@@ -44,7 +44,7 @@ on:
44
44
  description: 'Update as devDependency (only for single package selection)'
45
45
  required: false
46
46
  type: boolean
47
- default: '@diplodoc/transform'
47
+ default: false
48
48
  packages:
49
49
  description: 'Package names to update (comma-separated, e.g., "@diplodoc/transform,dev:@diplodoc/client"). Use "dev:" prefix for devDependencies. If empty, uses single package selection above.'
50
50
  required: false
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "5.8.0"
2
+ ".": "5.8.1"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.8.1](https://github.com/diplodoc-platform/client/compare/v5.8.0...v5.8.1) (2026-07-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add cursor pointer to gallery images ([3c0707d](https://github.com/diplodoc-platform/client/commit/3c0707de18ff2e35f61c161e74cf15574b818e5a))
9
+ * **deps:** Update dev:@diplodoc/mermaid-extension@2.2.0 ([#382](https://github.com/diplodoc-platform/client/issues/382)) ([8ec91b4](https://github.com/diplodoc-platform/client/commit/8ec91b49cee59dc2f4ccb069f5c3e3db308ea0cf))
10
+
3
11
  ## [5.8.0](https://github.com/diplodoc-platform/client/compare/v5.7.14...v5.8.0) (2026-07-06)
4
12
 
5
13