@xn-intenton-z2a/agentic-lib 7.1.12 → 7.1.14
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.
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export async function discussions(context) {
|
|
|
27
27
|
let discussionTitle = "";
|
|
28
28
|
let discussionBody = "";
|
|
29
29
|
let discussionComments = [];
|
|
30
|
+
let discussionNodeId = "";
|
|
30
31
|
|
|
31
32
|
if (urlMatch) {
|
|
32
33
|
const [, urlOwner, urlRepo, discussionNumber] = urlMatch;
|
|
@@ -34,6 +35,7 @@ export async function discussions(context) {
|
|
|
34
35
|
const query = `query {
|
|
35
36
|
repository(owner: "${urlOwner}", name: "${urlRepo}") {
|
|
36
37
|
discussion(number: ${discussionNumber}) {
|
|
38
|
+
id
|
|
37
39
|
title
|
|
38
40
|
body
|
|
39
41
|
comments(last: 10) {
|
|
@@ -48,6 +50,7 @@ export async function discussions(context) {
|
|
|
48
50
|
}`;
|
|
49
51
|
const result = await octokit.graphql(query);
|
|
50
52
|
const discussion = result.repository.discussion;
|
|
53
|
+
discussionNodeId = discussion.id || "";
|
|
51
54
|
discussionTitle = discussion.title || "";
|
|
52
55
|
discussionBody = discussion.body || "";
|
|
53
56
|
discussionComments = discussion.comments.nodes || [];
|
|
@@ -128,6 +131,28 @@ export async function discussions(context) {
|
|
|
128
131
|
|
|
129
132
|
core.info(`Discussion bot action: ${action}, arg: ${actionArg}`);
|
|
130
133
|
|
|
134
|
+
// Post reply comment back to the Discussion
|
|
135
|
+
if (discussionNodeId && replyBody) {
|
|
136
|
+
try {
|
|
137
|
+
const mutation = `mutation($discussionId: ID!, $body: String!) {
|
|
138
|
+
addDiscussionComment(input: { discussionId: $discussionId, body: $body }) {
|
|
139
|
+
comment { url }
|
|
140
|
+
}
|
|
141
|
+
}`;
|
|
142
|
+
const { addDiscussionComment } = await octokit.graphql(mutation, {
|
|
143
|
+
discussionId: discussionNodeId,
|
|
144
|
+
body: replyBody,
|
|
145
|
+
});
|
|
146
|
+
core.info(`Posted reply to discussion: ${addDiscussionComment.comment.url}`);
|
|
147
|
+
} catch (err) {
|
|
148
|
+
core.warning(`Failed to post discussion reply: ${err.message}`);
|
|
149
|
+
}
|
|
150
|
+
} else if (!discussionNodeId) {
|
|
151
|
+
core.warning("Cannot post reply: discussion node ID not available");
|
|
152
|
+
} else if (!replyBody) {
|
|
153
|
+
core.warning("Cannot post reply: no reply content generated");
|
|
154
|
+
}
|
|
155
|
+
|
|
131
156
|
const argSuffix = actionArg ? ` (${actionArg})` : "";
|
|
132
157
|
return {
|
|
133
158
|
outcome: `discussion-${action}`,
|
|
@@ -25,7 +25,7 @@ on:
|
|
|
25
25
|
workflow_dispatch:
|
|
26
26
|
|
|
27
27
|
permissions:
|
|
28
|
-
contents:
|
|
28
|
+
contents: read
|
|
29
29
|
issues: write
|
|
30
30
|
discussions: write
|
|
31
31
|
|
|
@@ -70,9 +70,3 @@ jobs:
|
|
|
70
70
|
config: ${{ env.configPath }}
|
|
71
71
|
instructions: ".github/agentic-lib/agents/agent-discussion-bot.md"
|
|
72
72
|
discussion-url: ${{ steps.discussion-url.outputs.url }}
|
|
73
|
-
|
|
74
|
-
- name: Commit activity log changes
|
|
75
|
-
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
76
|
-
with:
|
|
77
|
-
commit-message: "agentic-step: discussions bot response"
|
|
78
|
-
push-ref: ${{ github.ref_name }}
|
|
@@ -32,8 +32,7 @@ env:
|
|
|
32
32
|
configPath: ".github/agentic-lib/agents/agentic-lib.yml"
|
|
33
33
|
|
|
34
34
|
jobs:
|
|
35
|
-
maintain
|
|
36
|
-
if: inputs.step == 'all' || inputs.step == 'features' || github.event_name == 'schedule'
|
|
35
|
+
maintain:
|
|
37
36
|
runs-on: ubuntu-latest
|
|
38
37
|
steps:
|
|
39
38
|
- uses: actions/checkout@v4
|
|
@@ -48,14 +47,18 @@ jobs:
|
|
|
48
47
|
working-directory: .github/agentic-lib/actions/agentic-step
|
|
49
48
|
run: npm ci
|
|
50
49
|
|
|
51
|
-
- name: Load config
|
|
52
|
-
id:
|
|
50
|
+
- name: Load config
|
|
51
|
+
id: config
|
|
53
52
|
run: |
|
|
54
53
|
CONFIG="${{ env.configPath }}"
|
|
55
54
|
FEATURES=$(yq -r '.paths.featuresPath.path // ".github/agentic-lib/features/"' "$CONFIG")
|
|
56
|
-
|
|
55
|
+
LIBRARY=$(yq -r '.paths.libraryDocumentsPath.path // "library/"' "$CONFIG")
|
|
56
|
+
SOURCES=$(yq -r '.paths.librarySourcesFilepath.path // "SOURCES.md"' "$CONFIG")
|
|
57
|
+
echo "featuresWritablePaths=${FEATURES}" >> $GITHUB_OUTPUT
|
|
58
|
+
echo "libraryWritablePaths=${LIBRARY};${SOURCES}" >> $GITHUB_OUTPUT
|
|
57
59
|
|
|
58
60
|
- name: Maintain features
|
|
61
|
+
if: inputs.step == 'all' || inputs.step == 'features' || github.event_name == 'schedule'
|
|
59
62
|
uses: ./.github/agentic-lib/actions/agentic-step
|
|
60
63
|
env:
|
|
61
64
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -64,40 +67,10 @@ jobs:
|
|
|
64
67
|
task: "maintain-features"
|
|
65
68
|
config: ${{ env.configPath }}
|
|
66
69
|
instructions: ".github/agentic-lib/agents/agent-maintain-features.md"
|
|
67
|
-
writable-paths: ${{ steps.
|
|
68
|
-
|
|
69
|
-
- name: Commit and push changes
|
|
70
|
-
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
71
|
-
with:
|
|
72
|
-
commit-message: "agentic-step: maintain-features"
|
|
73
|
-
push-ref: ${{ github.ref_name }}
|
|
74
|
-
|
|
75
|
-
maintain-library:
|
|
76
|
-
needs: maintain-features
|
|
77
|
-
if: always() && (inputs.step == 'all' || inputs.step == 'library' || github.event_name == 'schedule')
|
|
78
|
-
runs-on: ubuntu-latest
|
|
79
|
-
steps:
|
|
80
|
-
- uses: actions/checkout@v4
|
|
81
|
-
with:
|
|
82
|
-
fetch-depth: 0
|
|
83
|
-
|
|
84
|
-
- uses: actions/setup-node@v4
|
|
85
|
-
with:
|
|
86
|
-
node-version: "24"
|
|
87
|
-
|
|
88
|
-
- name: Install agentic-step dependencies
|
|
89
|
-
working-directory: .github/agentic-lib/actions/agentic-step
|
|
90
|
-
run: npm ci
|
|
91
|
-
|
|
92
|
-
- name: Load config for library
|
|
93
|
-
id: library-config
|
|
94
|
-
run: |
|
|
95
|
-
CONFIG="${{ env.configPath }}"
|
|
96
|
-
LIBRARY=$(yq -r '.paths.libraryDocumentsPath.path // "library/"' "$CONFIG")
|
|
97
|
-
SOURCES=$(yq -r '.paths.librarySourcesFilepath.path // "SOURCES.md"' "$CONFIG")
|
|
98
|
-
echo "writablePaths=${LIBRARY};${SOURCES}" >> $GITHUB_OUTPUT
|
|
70
|
+
writable-paths: ${{ steps.config.outputs.featuresWritablePaths }}
|
|
99
71
|
|
|
100
72
|
- name: Maintain library
|
|
73
|
+
if: inputs.step == 'all' || inputs.step == 'library' || github.event_name == 'schedule'
|
|
101
74
|
uses: ./.github/agentic-lib/actions/agentic-step
|
|
102
75
|
env:
|
|
103
76
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -106,10 +79,10 @@ jobs:
|
|
|
106
79
|
task: "maintain-library"
|
|
107
80
|
config: ${{ env.configPath }}
|
|
108
81
|
instructions: ".github/agentic-lib/agents/agent-maintain-library.md"
|
|
109
|
-
writable-paths: ${{ steps.
|
|
82
|
+
writable-paths: ${{ steps.config.outputs.libraryWritablePaths }}
|
|
110
83
|
|
|
111
84
|
- name: Commit and push changes
|
|
112
85
|
uses: ./.github/agentic-lib/actions/commit-if-changed
|
|
113
86
|
with:
|
|
114
|
-
commit-message: "agentic-step: maintain
|
|
87
|
+
commit-message: "agentic-step: maintain features and library"
|
|
115
88
|
push-ref: ${{ github.ref_name }}
|
|
@@ -12,6 +12,11 @@ run-name: "ci-automerge [${{ github.ref_name }}]"
|
|
|
12
12
|
on:
|
|
13
13
|
pull_request:
|
|
14
14
|
check_suite:
|
|
15
|
+
workflow_run:
|
|
16
|
+
workflows:
|
|
17
|
+
- test
|
|
18
|
+
types:
|
|
19
|
+
- completed
|
|
15
20
|
workflow_dispatch:
|
|
16
21
|
workflow_call:
|
|
17
22
|
inputs:
|
|
@@ -148,7 +153,12 @@ jobs:
|
|
|
148
153
|
|
|
149
154
|
ls:
|
|
150
155
|
needs: label
|
|
151
|
-
if:
|
|
156
|
+
if: >-
|
|
157
|
+
github.event_name == 'schedule' ||
|
|
158
|
+
github.event_name == 'workflow_dispatch' ||
|
|
159
|
+
github.event_name == 'workflow_run' ||
|
|
160
|
+
inputs.workflow == 'true' ||
|
|
161
|
+
github.event_name == 'workflow_call'
|
|
152
162
|
runs-on: ubuntu-latest
|
|
153
163
|
steps:
|
|
154
164
|
- name: Determine pull request number
|
|
@@ -359,6 +369,9 @@ jobs:
|
|
|
359
369
|
message += ` Failed to delete branch: ${error.message}`;
|
|
360
370
|
}
|
|
361
371
|
prMerged = 'false';
|
|
372
|
+
} else if (pullRequest.mergeable_state === 'unstable') {
|
|
373
|
+
message = `PR #${pullNumber} checks still running (mergeable_state: unstable). Will retry when test workflow completes.`;
|
|
374
|
+
prMerged = 'false';
|
|
362
375
|
} else if (pullRequest.mergeable === null) {
|
|
363
376
|
message = `PR #${pullNumber} does not yet have a value for mergeability.`;
|
|
364
377
|
prMerged = 'false';
|
|
@@ -445,100 +458,3 @@ jobs:
|
|
|
445
458
|
owner, repo, issue_number: issueNumber, name: 'in-progress',
|
|
446
459
|
});
|
|
447
460
|
}
|
|
448
|
-
|
|
449
|
-
log-intention-activity-merge-pr:
|
|
450
|
-
needs:
|
|
451
|
-
- merge-check
|
|
452
|
-
- automerge
|
|
453
|
-
if: ${{ !cancelled() && needs.merge-check.outputs.shouldSkipMerge != 'true' && needs.merge-check.outputs.pullNumber != '' }}
|
|
454
|
-
runs-on: ubuntu-latest
|
|
455
|
-
env:
|
|
456
|
-
gitUserEmail: "action@github.com"
|
|
457
|
-
gitUserName: "GitHub Actions[bot]"
|
|
458
|
-
steps:
|
|
459
|
-
- uses: actions/checkout@v4
|
|
460
|
-
with:
|
|
461
|
-
fetch-depth: 0
|
|
462
|
-
ref: main
|
|
463
|
-
|
|
464
|
-
- name: Load config
|
|
465
|
-
id: config
|
|
466
|
-
run: |
|
|
467
|
-
CONFIG="${{ vars.configPath || '.github/agentic-lib/agents/agentic-lib.yml' }}"
|
|
468
|
-
echo "intentionFilepath=$(yq -r '.intentionBot.intentionFilepath // "intentïon.md"' "$CONFIG")" >> $GITHUB_OUTPUT
|
|
469
|
-
|
|
470
|
-
- name: Get latest from remote
|
|
471
|
-
run: |
|
|
472
|
-
git config --local user.email '${{ env.gitUserEmail }}'
|
|
473
|
-
git config --local user.name '${{ env.gitUserName }}'
|
|
474
|
-
git config --local pull.ff false # never fast-forward
|
|
475
|
-
git config --local pull.rebase false # never rebase on pull
|
|
476
|
-
git fetch origin main
|
|
477
|
-
git merge origin/main --no-ff --no-edit --strategy=recursive --strategy-option=ours
|
|
478
|
-
|
|
479
|
-
- name: log-intention-activity
|
|
480
|
-
id: log-intention-activity
|
|
481
|
-
uses: actions/github-script@v7
|
|
482
|
-
env:
|
|
483
|
-
pullNumber: ${{ needs.merge-check.outputs.pullNumber }}
|
|
484
|
-
shouldSkipMerge: ${{ needs.merge-check.outputs.shouldSkipMerge }}
|
|
485
|
-
branchName: ${{ needs.merge-check.outputs.branchName }}
|
|
486
|
-
issueNumber: ${{ needs.merge-check.outputs.issueNumber }}
|
|
487
|
-
prMerged: ${{ needs.automerge.outputs.prMerged }}
|
|
488
|
-
message: ${{ needs.automerge.outputs.message }}
|
|
489
|
-
outcome: ${{ needs.automerge.result }}
|
|
490
|
-
intentionFilepath: ${{ steps.config.outputs.intentionFilepath }}
|
|
491
|
-
with:
|
|
492
|
-
script: |
|
|
493
|
-
const pullNumber = process.env.pullNumber;
|
|
494
|
-
const shouldSkipMerge = process.env.shouldSkipMerge;
|
|
495
|
-
const branchName = process.env.branchName;
|
|
496
|
-
const issueNumber = process.env.issueNumber;
|
|
497
|
-
const prMerged = process.env.prMerged;
|
|
498
|
-
const message = process.env.message;
|
|
499
|
-
const outcome = process.env.outcome;
|
|
500
|
-
const intentionFilepath = process.env.intentionFilepath;
|
|
501
|
-
|
|
502
|
-
const activity = `When attempting to merge PR #${pullNumber} for branch name "${branchName}" to resolve issue number "${issueNumber}" the decision to skip merge was "${shouldSkipMerge}":
|
|
503
|
-
|
|
504
|
-
then the PR was merged "${prMerged}"
|
|
505
|
-
|
|
506
|
-
with message: "${message}"
|
|
507
|
-
|
|
508
|
-
with outcome "${outcome}".`;
|
|
509
|
-
|
|
510
|
-
core.info(`Activity: ${activity}`);
|
|
511
|
-
core.info(`Seed discussion filepath: ${intentionFilepath}`);
|
|
512
|
-
|
|
513
|
-
const fs = require('fs');
|
|
514
|
-
const path = require('path');
|
|
515
|
-
|
|
516
|
-
// Create trace file and the parent directory of intentionFilepath if it doesn't exist
|
|
517
|
-
if (!fs.existsSync(path.dirname(intentionFilepath))) {
|
|
518
|
-
fs.mkdirSync(path.dirname(intentionFilepath), { recursive: true });
|
|
519
|
-
}
|
|
520
|
-
const isoDate = new Date().toISOString();
|
|
521
|
-
const activityLogContent = `\n## Merge PR activity at ${isoDate}
|
|
522
|
-
|
|
523
|
-
${activity}
|
|
524
|
-
|
|
525
|
-
---
|
|
526
|
-
`;
|
|
527
|
-
if (fs.existsSync(intentionFilepath)) {
|
|
528
|
-
fs.appendFileSync(intentionFilepath, activityLogContent);
|
|
529
|
-
} else {
|
|
530
|
-
fs.writeFileSync(intentionFilepath, activityLogContent);
|
|
531
|
-
}
|
|
532
|
-
core.info(`Activity logged to ${intentionFilepath}`);
|
|
533
|
-
|
|
534
|
-
- name: Commit changes
|
|
535
|
-
run: |
|
|
536
|
-
git config --local user.email '${{ env.gitUserEmail }}'
|
|
537
|
-
git config --local user.name '${{ env.gitUserName }}'
|
|
538
|
-
git config --local pull.ff false # never fast-forward
|
|
539
|
-
git config --local pull.rebase false # never rebase on pull
|
|
540
|
-
git add ${{ steps.config.outputs.intentionFilepath }}
|
|
541
|
-
git commit -m "Activity logged by ci-automerge.yml" || echo "No changes to commit"
|
|
542
|
-
git fetch origin main
|
|
543
|
-
git merge origin/main --no-ff --no-edit --strategy=recursive --strategy-option=ours
|
|
544
|
-
git push -v origin main
|