@plainconceptsplatform/workflows 0.1.2 → 0.1.5

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.
Files changed (67) hide show
  1. package/README.md +28 -10
  2. package/dist/catalog-installation.d.ts +3 -2
  3. package/dist/catalog-installation.js +26 -6
  4. package/dist/catalog-installation.test.js +104 -10
  5. package/dist/catalog-listing.d.ts +13 -0
  6. package/dist/catalog-listing.js +68 -0
  7. package/dist/catalog-listing.test.d.ts +1 -0
  8. package/dist/catalog-listing.test.js +137 -0
  9. package/dist/index.js +62 -11
  10. package/dist/index.test.d.ts +1 -0
  11. package/dist/index.test.js +112 -0
  12. package/dist/repository-inspection.test.d.ts +1 -0
  13. package/dist/repository-inspection.test.js +77 -0
  14. package/dist/workflow-catalog.d.ts +9 -7
  15. package/dist/workflow-catalog.js +21 -16
  16. package/dist/workflow-catalog.test.js +18 -3
  17. package/loops/actions/add-issue-labels/action.yml +30 -29
  18. package/loops/actions/agent-output.cjs +1 -0
  19. package/loops/actions/apply-agent-bundle/action.yml +24 -23
  20. package/loops/actions/apply-agent-bundle/apply-bundle.sh +1 -0
  21. package/loops/actions/apply-agent-comments/action.yml +42 -41
  22. package/loops/actions/apply-agent-labels/action.yml +55 -54
  23. package/loops/actions/apply-agent-output/action.yml +108 -107
  24. package/loops/actions/audit-close/action.yml +104 -103
  25. package/loops/actions/classify-route/action.yml +91 -90
  26. package/loops/actions/classify-route/classify-route.sh +1 -0
  27. package/loops/actions/cleanup-artifacts/action.yml +65 -64
  28. package/loops/actions/close-agent-issues/action.yml +43 -42
  29. package/loops/actions/create-agent-issues/action.yml +52 -51
  30. package/loops/actions/create-issue-comment/action.yml +29 -28
  31. package/loops/actions/download-agent-output/action.yml +53 -52
  32. package/loops/actions/identify-gate-subject/action.yml +97 -96
  33. package/loops/actions/link-pr-to-issue/action.yml +40 -39
  34. package/loops/actions/list-open-issues/action.yml +33 -32
  35. package/loops/actions/load-issue-context/action.yml +43 -42
  36. package/loops/actions/merge-agent-pr/action.yml +36 -35
  37. package/loops/actions/push-agent-branch/action.yml +45 -44
  38. package/loops/actions/remove-issue-labels/action.yml +35 -34
  39. package/loops/actions/stale-recovery/action.yml +288 -287
  40. package/loops/actions/update-agent-issues/action.yml +58 -57
  41. package/loops/actions/validate-refine-output/action.yml +44 -43
  42. package/loops/actions/validate-refine-output/validate-refine-output.sh +1 -0
  43. package/loops/actions/verify-composite-actions/action.yml +9 -8
  44. package/loops/actions/verify-composite-actions/verify-composite-actions.sh +1 -0
  45. package/loops/actions/verify-refine-output/action.yml +9 -8
  46. package/loops/actions/verify-refine-output/verify-refine-output.sh +1 -0
  47. package/loops/actions/verify-route-matrix/action.yml +9 -8
  48. package/loops/actions/verify-route-matrix/verify-route-matrix.sh +1 -0
  49. package/loops/scripts/compile-agent-workflows.mjs +18 -2
  50. package/loops/templates/agentics/agentics-checks.yml +86 -0
  51. package/loops/templates/agentics/agentics-maintenance.yml +121 -0
  52. package/loops/templates/ci/app-ci-dotnet-next.yml +167 -0
  53. package/loops/templates/ci/app-ci-node-monorepo.yml +178 -0
  54. package/loops/templates/opencode/opencode.ci.json +46 -0
  55. package/loops/templates/opencode/opencode.ci.json.md +41 -0
  56. package/loops/workflows/agent-apply-review.md +9 -10
  57. package/loops/workflows/agent-audit.md +6 -7
  58. package/loops/workflows/agent-direct.md +7 -8
  59. package/loops/workflows/agent-implement.md +7 -8
  60. package/loops/workflows/agent-merge-gate.md +9 -10
  61. package/loops/workflows/agent-propose.md +7 -8
  62. package/loops/workflows/agent-refine.md +5 -7
  63. package/loops/workflows/shared/opencode-ci.md +1 -0
  64. package/loops/workflows/shared/platform-defaults.md +1 -0
  65. package/loops/workflows/work-router.yml +1 -0
  66. package/package.json +2 -2
  67. package/loops/aw/repo-config.md +0 -12
@@ -1,96 +1,97 @@
1
- name: Identify gate subject
2
- description: Confirm the pull request is one we authored, resolve the issue it closes, and check that issue carries the required label.
3
- inputs:
4
- token:
5
- description: GitHub token with issues and pull-requests read access.
6
- required: true
7
- pr-number:
8
- description: Pull request number to gate.
9
- required: true
10
- ci-conclusion:
11
- description: Conclusion reported by the CI run that triggered this gate.
12
- required: true
13
- linked-issue:
14
- description: Issue the pull request closes, when the router already resolved it.
15
- required: false
16
- default: ''
17
- require-label:
18
- description: Label the closing issue must carry. Empty disables the check.
19
- required: false
20
- default: ''
21
- outputs:
22
- found:
23
- description: Whether a valid gate subject was found.
24
- value: ${{ steps.identify.outputs.found }}
25
- pr:
26
- description: Pull request number.
27
- value: ${{ steps.identify.outputs.pr }}
28
- issue:
29
- description: Issue number the pull request closes.
30
- value: ${{ steps.identify.outputs.issue }}
31
- conclusion:
32
- description: CI conclusion, passed through unchanged.
33
- value: ${{ steps.identify.outputs.conclusion }}
34
- runs:
35
- using: composite
36
- steps:
37
- - name: Identify pull request and closing issue
38
- id: identify
39
- shell: bash
40
- env:
41
- GH_TOKEN: ${{ inputs.token }}
42
- REPO: ${{ github.repository }}
43
- PR_NUMBER: ${{ inputs.pr-number }}
44
- CONCLUSION: ${{ inputs.ci-conclusion }}
45
- LINKED_ISSUE: ${{ inputs.linked-issue }}
46
- REQUIRE_LABEL: ${{ inputs.require-label }}
47
- run: |
48
- set -euo pipefail
49
-
50
- none() {
51
- echo "found=false" >> "$GITHUB_OUTPUT"
52
- echo "$1"
53
- exit 0
54
- }
55
-
56
- pr="$(gh pr view "$PR_NUMBER" --repo "$REPO" \
57
- --json state,author,closingIssuesReferences,body)"
58
-
59
- [ "$(jq -r '.state' <<<"$pr")" = "OPEN" ] || none "PR #$PR_NUMBER is not open"
60
-
61
- # Use GitHub's bot flag because App login formats differ across APIs.
62
- if [ "$(jq -r '.author.is_bot' <<<"$pr")" != "true" ]; then
63
- none "PR #$PR_NUMBER was authored by $(jq -r '.author.login' <<<"$pr"), a human."
64
- fi
65
-
66
- issue="$LINKED_ISSUE"
67
-
68
- if [ -z "$issue" ]; then
69
- issue="$(jq -r '.closingIssuesReferences[0].number // empty' <<<"$pr")"
70
- fi
71
-
72
- if [ -z "$issue" ]; then
73
- issue="$(jq -r '.body // ""' <<<"$pr" |
74
- grep -oiE '(close[sd]?|fixe?[sd]?|resolve[sd]?) +#[0-9]+' |
75
- grep -oE '[0-9]+' | head -n 1 || true)"
76
- fi
77
-
78
- [ -n "$issue" ] || none "PR #$PR_NUMBER does not close a numbered issue"
79
-
80
- if [ -n "$REQUIRE_LABEL" ]; then
81
- labels="$(gh issue view "$issue" --repo "$REPO" --json labels \
82
- --jq '[.labels[].name]')"
83
-
84
- if ! jq -e --arg name "$REQUIRE_LABEL" 'index($name)' >/dev/null <<<"$labels"; then
85
- none "issue #$issue does not carry $REQUIRE_LABEL (has: $(jq -r 'join(", ")' <<<"$labels"))"
86
- fi
87
- fi
88
-
89
- {
90
- echo "found=true"
91
- echo "pr=$PR_NUMBER"
92
- echo "issue=$issue"
93
- echo "conclusion=$CONCLUSION"
94
- } >> "$GITHUB_OUTPUT"
95
-
96
- echo "PR #$PR_NUMBER closes #$issue; CI concluded $CONCLUSION"
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/identify-gate-subject/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: Identify gate subject
3
+ description: Confirm the pull request is one we authored, resolve the issue it closes, and check that issue carries the required label.
4
+ inputs:
5
+ token:
6
+ description: GitHub token with issues and pull-requests read access.
7
+ required: true
8
+ pr-number:
9
+ description: Pull request number to gate.
10
+ required: true
11
+ ci-conclusion:
12
+ description: Conclusion reported by the CI run that triggered this gate.
13
+ required: true
14
+ linked-issue:
15
+ description: Issue the pull request closes, when the router already resolved it.
16
+ required: false
17
+ default: ''
18
+ require-label:
19
+ description: Label the closing issue must carry. Empty disables the check.
20
+ required: false
21
+ default: ''
22
+ outputs:
23
+ found:
24
+ description: Whether a valid gate subject was found.
25
+ value: ${{ steps.identify.outputs.found }}
26
+ pr:
27
+ description: Pull request number.
28
+ value: ${{ steps.identify.outputs.pr }}
29
+ issue:
30
+ description: Issue number the pull request closes.
31
+ value: ${{ steps.identify.outputs.issue }}
32
+ conclusion:
33
+ description: CI conclusion, passed through unchanged.
34
+ value: ${{ steps.identify.outputs.conclusion }}
35
+ runs:
36
+ using: composite
37
+ steps:
38
+ - name: Identify pull request and closing issue
39
+ id: identify
40
+ shell: bash
41
+ env:
42
+ GH_TOKEN: ${{ inputs.token }}
43
+ REPO: ${{ github.repository }}
44
+ PR_NUMBER: ${{ inputs.pr-number }}
45
+ CONCLUSION: ${{ inputs.ci-conclusion }}
46
+ LINKED_ISSUE: ${{ inputs.linked-issue }}
47
+ REQUIRE_LABEL: ${{ inputs.require-label }}
48
+ run: |
49
+ set -euo pipefail
50
+
51
+ none() {
52
+ echo "found=false" >> "$GITHUB_OUTPUT"
53
+ echo "$1"
54
+ exit 0
55
+ }
56
+
57
+ pr="$(gh pr view "$PR_NUMBER" --repo "$REPO" \
58
+ --json state,author,closingIssuesReferences,body)"
59
+
60
+ [ "$(jq -r '.state' <<<"$pr")" = "OPEN" ] || none "PR #$PR_NUMBER is not open"
61
+
62
+ # Use GitHub's bot flag because App login formats differ across APIs.
63
+ if [ "$(jq -r '.author.is_bot' <<<"$pr")" != "true" ]; then
64
+ none "PR #$PR_NUMBER was authored by $(jq -r '.author.login' <<<"$pr"), a human."
65
+ fi
66
+
67
+ issue="$LINKED_ISSUE"
68
+
69
+ if [ -z "$issue" ]; then
70
+ issue="$(jq -r '.closingIssuesReferences[0].number // empty' <<<"$pr")"
71
+ fi
72
+
73
+ if [ -z "$issue" ]; then
74
+ issue="$(jq -r '.body // ""' <<<"$pr" |
75
+ grep -oiE '(close[sd]?|fixe?[sd]?|resolve[sd]?) +#[0-9]+' |
76
+ grep -oE '[0-9]+' | head -n 1 || true)"
77
+ fi
78
+
79
+ [ -n "$issue" ] || none "PR #$PR_NUMBER does not close a numbered issue"
80
+
81
+ if [ -n "$REQUIRE_LABEL" ]; then
82
+ labels="$(gh issue view "$issue" --repo "$REPO" --json labels \
83
+ --jq '[.labels[].name]')"
84
+
85
+ if ! jq -e --arg name "$REQUIRE_LABEL" 'index($name)' >/dev/null <<<"$labels"; then
86
+ none "issue #$issue does not carry $REQUIRE_LABEL (has: $(jq -r 'join(", ")' <<<"$labels"))"
87
+ fi
88
+ fi
89
+
90
+ {
91
+ echo "found=true"
92
+ echo "pr=$PR_NUMBER"
93
+ echo "issue=$issue"
94
+ echo "conclusion=$CONCLUSION"
95
+ } >> "$GITHUB_OUTPUT"
96
+
97
+ echo "PR #$PR_NUMBER closes #$issue; CI concluded $CONCLUSION"
@@ -1,39 +1,40 @@
1
- name: Link pull request to issue
2
- description: Ensure the pull request body carries a closing reference to its source issue.
3
- inputs:
4
- token:
5
- description: GitHub token with pull-requests write access.
6
- required: true
7
- pr-number:
8
- description: Pull request number.
9
- required: true
10
- issue-number:
11
- description: Issue number the pull request should close.
12
- required: true
13
- runs:
14
- using: composite
15
- steps:
16
- - name: Ensure a closing reference
17
- shell: bash
18
- env:
19
- GH_TOKEN: ${{ inputs.token }}
20
- REPO: ${{ github.repository }}
21
- PR_NUMBER: ${{ inputs.pr-number }}
22
- ISSUE_NUMBER: ${{ inputs.issue-number }}
23
- run: |
24
- set -euo pipefail
25
-
26
- pr="$(gh pr view "$PR_NUMBER" --repo "$REPO" --json closingIssuesReferences,body)"
27
-
28
- if [ "$(jq '.closingIssuesReferences | length' <<<"$pr")" -gt 0 ]; then
29
- echo "PR #$PR_NUMBER already closes an issue."
30
- exit 0
31
- fi
32
-
33
- # A closing reference can only be created from the pull request body; there is no
34
- # REST or GraphQL mutation for it.
35
- body="$(jq -r '.body // ""' <<<"$pr")"
36
- printf '%s\n\nCloses #%s\n' "$body" "$ISSUE_NUMBER" > /tmp/pr-body.md
37
-
38
- gh pr edit "$PR_NUMBER" --repo "$REPO" --body-file /tmp/pr-body.md
39
- echo "Added 'Closes #$ISSUE_NUMBER' to PR #$PR_NUMBER."
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/link-pr-to-issue/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: Link pull request to issue
3
+ description: Ensure the pull request body carries a closing reference to its source issue.
4
+ inputs:
5
+ token:
6
+ description: GitHub token with pull-requests write access.
7
+ required: true
8
+ pr-number:
9
+ description: Pull request number.
10
+ required: true
11
+ issue-number:
12
+ description: Issue number the pull request should close.
13
+ required: true
14
+ runs:
15
+ using: composite
16
+ steps:
17
+ - name: Ensure a closing reference
18
+ shell: bash
19
+ env:
20
+ GH_TOKEN: ${{ inputs.token }}
21
+ REPO: ${{ github.repository }}
22
+ PR_NUMBER: ${{ inputs.pr-number }}
23
+ ISSUE_NUMBER: ${{ inputs.issue-number }}
24
+ run: |
25
+ set -euo pipefail
26
+
27
+ pr="$(gh pr view "$PR_NUMBER" --repo "$REPO" --json closingIssuesReferences,body)"
28
+
29
+ if [ "$(jq '.closingIssuesReferences | length' <<<"$pr")" -gt 0 ]; then
30
+ echo "PR #$PR_NUMBER already closes an issue."
31
+ exit 0
32
+ fi
33
+
34
+ # A closing reference can only be created from the pull request body; there is no
35
+ # REST or GraphQL mutation for it.
36
+ body="$(jq -r '.body // ""' <<<"$pr")"
37
+ printf '%s\n\nCloses #%s\n' "$body" "$ISSUE_NUMBER" > /tmp/pr-body.md
38
+
39
+ gh pr edit "$PR_NUMBER" --repo "$REPO" --body-file /tmp/pr-body.md
40
+ echo "Added 'Closes #$ISSUE_NUMBER' to PR #$PR_NUMBER."
@@ -1,32 +1,33 @@
1
- name: List open issues
2
- description: |
3
- Writes all open issues (number, title, labels) to `/tmp/gh-aw/agent/open-issues.json`
4
- so the agent can check for semantic duplicates without spending turns discovering them.
5
- inputs:
6
- token:
7
- description: GitHub token with issues:read permission.
8
- required: true
9
- repo:
10
- description: Repository in `owner/name` format.
11
- required: true
12
- output-path:
13
- description: Path to write the JSON output.
14
- required: false
15
- default: /tmp/gh-aw/agent/open-issues.json
16
- runs:
17
- using: composite
18
- steps:
19
- - name: List open issues
20
- shell: bash
21
- env:
22
- GH_TOKEN: ${{ inputs.token }}
23
- REPO: ${{ inputs.repo }}
24
- OUTPUT_PATH: ${{ inputs.output-path }}
25
- run: |
26
- set -euo pipefail
27
- mkdir -p "$(dirname "$OUTPUT_PATH")"
28
- gh issue list --repo "$REPO" --state open --limit 500 \
29
- --json number,title,labels \
30
- --jq '[.[] | {number, title, labels: [.labels[].name]}]' \
31
- > "$OUTPUT_PATH"
32
- echo "Wrote $(jq 'length' "$OUTPUT_PATH") open issues to $OUTPUT_PATH"
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/list-open-issues/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: List open issues
3
+ description: |
4
+ Writes all open issues (number, title, labels) to `/tmp/gh-aw/agent/open-issues.json`
5
+ so the agent can check for semantic duplicates without spending turns discovering them.
6
+ inputs:
7
+ token:
8
+ description: GitHub token with issues:read permission.
9
+ required: true
10
+ repo:
11
+ description: Repository in `owner/name` format.
12
+ required: true
13
+ output-path:
14
+ description: Path to write the JSON output.
15
+ required: false
16
+ default: /tmp/gh-aw/agent/open-issues.json
17
+ runs:
18
+ using: composite
19
+ steps:
20
+ - name: List open issues
21
+ shell: bash
22
+ env:
23
+ GH_TOKEN: ${{ inputs.token }}
24
+ REPO: ${{ inputs.repo }}
25
+ OUTPUT_PATH: ${{ inputs.output-path }}
26
+ run: |
27
+ set -euo pipefail
28
+ mkdir -p "$(dirname "$OUTPUT_PATH")"
29
+ gh issue list --repo "$REPO" --state open --limit 500 \
30
+ --json number,title,labels \
31
+ --jq '[.[] | {number, title, labels: [.labels[].name]}]' \
32
+ > "$OUTPUT_PATH"
33
+ echo "Wrote $(jq 'length' "$OUTPUT_PATH") open issues to $OUTPUT_PATH"
@@ -1,42 +1,43 @@
1
- name: Load issue context
2
- description: Write issue metadata and comment context to a JSON file.
3
- inputs:
4
- token:
5
- description: GitHub token used by github-script.
6
- required: true
7
- issue-number:
8
- description: Issue number to load.
9
- required: true
10
- output-path:
11
- description: Absolute path where context JSON is written.
12
- required: true
13
- runs:
14
- using: composite
15
- steps:
16
- - name: Load issue and comments
17
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
18
- env:
19
- ISSUE_NUMBER: ${{ inputs.issue-number }}
20
- OUTPUT_PATH: ${{ inputs.output-path }}
21
- with:
22
- github-token: ${{ inputs.token }}
23
- script: |
24
- const fs = require('fs');
25
- const issueNumber = Number(process.env.ISSUE_NUMBER);
26
- const issue = await github.rest.issues.get({ ...context.repo, issue_number: issueNumber });
27
- const comments = await github.paginate(github.rest.issues.listComments, {
28
- ...context.repo, issue_number: issueNumber, per_page: 100,
29
- });
30
-
31
- fs.mkdirSync(require('path').dirname(process.env.OUTPUT_PATH), { recursive: true });
32
- fs.writeFileSync(process.env.OUTPUT_PATH, JSON.stringify({
33
- number: issue.data.number,
34
- title: issue.data.title,
35
- body: issue.data.body,
36
- labels: issue.data.labels.map(({ name }) => name),
37
- comments: comments.map(({ user, author_association, body }) => ({
38
- author: user.login,
39
- association: author_association,
40
- body,
41
- })),
42
- }, null, 2));
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/load-issue-context/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: Load issue context
3
+ description: Write issue metadata and comment context to a JSON file.
4
+ inputs:
5
+ token:
6
+ description: GitHub token used by github-script.
7
+ required: true
8
+ issue-number:
9
+ description: Issue number to load.
10
+ required: true
11
+ output-path:
12
+ description: Absolute path where context JSON is written.
13
+ required: true
14
+ runs:
15
+ using: composite
16
+ steps:
17
+ - name: Load issue and comments
18
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
19
+ env:
20
+ ISSUE_NUMBER: ${{ inputs.issue-number }}
21
+ OUTPUT_PATH: ${{ inputs.output-path }}
22
+ with:
23
+ github-token: ${{ inputs.token }}
24
+ script: |
25
+ const fs = require('fs');
26
+ const issueNumber = Number(process.env.ISSUE_NUMBER);
27
+ const issue = await github.rest.issues.get({ ...context.repo, issue_number: issueNumber });
28
+ const comments = await github.paginate(github.rest.issues.listComments, {
29
+ ...context.repo, issue_number: issueNumber, per_page: 100,
30
+ });
31
+
32
+ fs.mkdirSync(require('path').dirname(process.env.OUTPUT_PATH), { recursive: true });
33
+ fs.writeFileSync(process.env.OUTPUT_PATH, JSON.stringify({
34
+ number: issue.data.number,
35
+ title: issue.data.title,
36
+ body: issue.data.body,
37
+ labels: issue.data.labels.map(({ name }) => name),
38
+ comments: comments.map(({ user, author_association, body }) => ({
39
+ author: user.login,
40
+ association: author_association,
41
+ body,
42
+ })),
43
+ }, null, 2));
@@ -1,35 +1,36 @@
1
- name: Merge agent pull request
2
- description: Read merge_pull_request from agent_output.json and merge the PR via gh.
3
- inputs:
4
- output-file:
5
- description: Path to agent_output.json.
6
- required: true
7
- token:
8
- description: GitHub token with pull-requests:write and contents:write.
9
- required: true
10
- repo:
11
- description: Target repository in owner/name format.
12
- required: false
13
- default: ${{ github.repository }}
14
- runs:
15
- using: composite
16
- steps:
17
- - name: Merge pull request
18
- shell: bash
19
- env:
20
- GH_TOKEN: ${{ inputs.token }}
21
- OUTPUT_FILE: ${{ inputs.output-file }}
22
- REPO: ${{ inputs.repo }}
23
- run: |
24
- set -euo pipefail
25
- [ -f "$OUTPUT_FILE" ] || exit 0
26
-
27
- jq -c '.items[] | select(.type == "merge_pull_request")' "$OUTPUT_FILE" | while read -r item; do
28
- PR_NUM=$(echo "$item" | jq -er '.pr_number // .item_number // empty')
29
- [[ "$PR_NUM" =~ ^[1-9][0-9]*$ ]] || { echo "::error::Invalid pull request number: $PR_NUM"; exit 1; }
30
-
31
- HEAD_SHA=$(gh pr view "$PR_NUM" --repo "$REPO" --json headRefOid --jq '.headRefOid')
32
- [[ "$HEAD_SHA" =~ ^[0-9a-fA-F]{40}$ ]] || { echo "::error::Invalid pull request head SHA for #$PR_NUM"; exit 1; }
33
-
34
- gh pr merge "$PR_NUM" --repo "$REPO" --squash --match-head-commit "$HEAD_SHA"
35
- done
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/merge-agent-pr/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: Merge agent pull request
3
+ description: Read merge_pull_request from agent_output.json and merge the PR via gh.
4
+ inputs:
5
+ output-file:
6
+ description: Path to agent_output.json.
7
+ required: true
8
+ token:
9
+ description: GitHub token with pull-requests:write and contents:write.
10
+ required: true
11
+ repo:
12
+ description: Target repository in owner/name format.
13
+ required: false
14
+ default: ${{ github.repository }}
15
+ runs:
16
+ using: composite
17
+ steps:
18
+ - name: Merge pull request
19
+ shell: bash
20
+ env:
21
+ GH_TOKEN: ${{ inputs.token }}
22
+ OUTPUT_FILE: ${{ inputs.output-file }}
23
+ REPO: ${{ inputs.repo }}
24
+ run: |
25
+ set -euo pipefail
26
+ [ -f "$OUTPUT_FILE" ] || exit 0
27
+
28
+ jq -c '.items[] | select(.type == "merge_pull_request")' "$OUTPUT_FILE" | while read -r item; do
29
+ PR_NUM=$(echo "$item" | jq -er '.pr_number // .item_number // empty')
30
+ [[ "$PR_NUM" =~ ^[1-9][0-9]*$ ]] || { echo "::error::Invalid pull request number: $PR_NUM"; exit 1; }
31
+
32
+ HEAD_SHA=$(gh pr view "$PR_NUM" --repo "$REPO" --json headRefOid --jq '.headRefOid')
33
+ [[ "$HEAD_SHA" =~ ^[0-9a-fA-F]{40}$ ]] || { echo "::error::Invalid pull request head SHA for #$PR_NUM"; exit 1; }
34
+
35
+ gh pr merge "$PR_NUM" --repo "$REPO" --squash --match-head-commit "$HEAD_SHA"
36
+ done
@@ -1,44 +1,45 @@
1
- name: Push agent branch
2
- description: Read push_to_pull_request_branch from agent_output.json and fast-forward from its git bundle.
3
- inputs:
4
- output-file:
5
- description: Path to agent_output.json.
6
- required: true
7
- bundle-file:
8
- description: Path to the git bundle from the agent artifact.
9
- required: false
10
- default: ''
11
- token:
12
- description: GitHub token with contents:write.
13
- required: true
14
- runs:
15
- using: composite
16
- steps:
17
- - name: Configure git credentials
18
- shell: bash
19
- env:
20
- GH_TOKEN: ${{ inputs.token }}
21
- run: |
22
- git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
23
- - name: Read pull request branch
24
- id: request
25
- shell: bash
26
- env:
27
- GH_TOKEN: ${{ inputs.token }}
28
- OUTPUT_FILE: ${{ inputs.output-file }}
29
- BUNDLE_FILE: ${{ inputs.bundle-file }}
30
- run: |
31
- set -euo pipefail
32
- [ -f "$OUTPUT_FILE" ] || exit 0
33
-
34
- ITEM=$(jq -c '.items[] | select(.type == "push_to_pull_request_branch")' "$OUTPUT_FILE")
35
- [ -n "$ITEM" ] || exit 0
36
-
37
- BRANCH=$(echo "$ITEM" | jq -r '.branch')
38
- echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
39
- - name: Apply bundle to pull request branch
40
- if: steps.request.outputs.branch != '' && inputs.bundle-file != ''
41
- uses: ./.github/actions/apply-agent-bundle
42
- with:
43
- bundle-file: ${{ inputs.bundle-file }}
44
- target-branch: ${{ steps.request.outputs.branch }}
1
+ # Managed by @plainconceptsplatform/workflows. Source: loops/actions/push-agent-branch/action.yml. Update with workflows update --force; consumer edits may be overwritten.
2
+ name: Push agent branch
3
+ description: Read push_to_pull_request_branch from agent_output.json and fast-forward from its git bundle.
4
+ inputs:
5
+ output-file:
6
+ description: Path to agent_output.json.
7
+ required: true
8
+ bundle-file:
9
+ description: Path to the git bundle from the agent artifact.
10
+ required: false
11
+ default: ''
12
+ token:
13
+ description: GitHub token with contents:write.
14
+ required: true
15
+ runs:
16
+ using: composite
17
+ steps:
18
+ - name: Configure git credentials
19
+ shell: bash
20
+ env:
21
+ GH_TOKEN: ${{ inputs.token }}
22
+ run: |
23
+ git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
24
+ - name: Read pull request branch
25
+ id: request
26
+ shell: bash
27
+ env:
28
+ GH_TOKEN: ${{ inputs.token }}
29
+ OUTPUT_FILE: ${{ inputs.output-file }}
30
+ BUNDLE_FILE: ${{ inputs.bundle-file }}
31
+ run: |
32
+ set -euo pipefail
33
+ [ -f "$OUTPUT_FILE" ] || exit 0
34
+
35
+ ITEM=$(jq -c '.items[] | select(.type == "push_to_pull_request_branch")' "$OUTPUT_FILE")
36
+ [ -n "$ITEM" ] || exit 0
37
+
38
+ BRANCH=$(echo "$ITEM" | jq -r '.branch')
39
+ echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
40
+ - name: Apply bundle to pull request branch
41
+ if: steps.request.outputs.branch != '' && inputs.bundle-file != ''
42
+ uses: ./.github/actions/apply-agent-bundle
43
+ with:
44
+ bundle-file: ${{ inputs.bundle-file }}
45
+ target-branch: ${{ steps.request.outputs.branch }}