@logickernel/agileflow 0.20.0 → 0.22.0
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/README.md +5 -2
- package/docs/guides/github-actions.md +27 -21
- package/package.json +1 -1
- package/src/github-push.js +10 -7
- package/src/utils.js +1 -1
package/README.md
CHANGED
|
@@ -61,6 +61,9 @@ on:
|
|
|
61
61
|
push:
|
|
62
62
|
branches: [main]
|
|
63
63
|
|
|
64
|
+
permissions:
|
|
65
|
+
contents: write
|
|
66
|
+
|
|
64
67
|
jobs:
|
|
65
68
|
version:
|
|
66
69
|
runs-on: ubuntu-latest
|
|
@@ -75,11 +78,11 @@ jobs:
|
|
|
75
78
|
|
|
76
79
|
- name: Create version tag
|
|
77
80
|
env:
|
|
78
|
-
|
|
81
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
79
82
|
run: npx @logickernel/agileflow github
|
|
80
83
|
```
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
Uses the built-in `GITHUB_TOKEN` — no custom tokens or secrets setup needed. Just grant `contents: write` permission and pass the token via `env`. You can also use a [Personal Access Token](./docs/guides/github-actions.md) if your organization restricts `GITHUB_TOKEN` permissions.
|
|
83
86
|
|
|
84
87
|
### GitLab CI
|
|
85
88
|
|
|
@@ -4,23 +4,7 @@ Two workflows: one that runs AgileFlow on push to main and creates a version tag
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
## Step 1: Create
|
|
8
|
-
|
|
9
|
-
1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
|
|
10
|
-
2. Click **Generate new token**
|
|
11
|
-
3. Set:
|
|
12
|
-
- **Name**: `AgileFlow`
|
|
13
|
-
- **Repository access**: your repository
|
|
14
|
-
- **Permissions**: `Contents: Read and write`
|
|
15
|
-
4. Copy the token
|
|
16
|
-
|
|
17
|
-
## Step 2: Add the token as a secret
|
|
18
|
-
|
|
19
|
-
1. In your repository: **Settings → Secrets and variables → Actions**
|
|
20
|
-
2. Click **New repository secret**
|
|
21
|
-
3. Name: `AGILEFLOW_TOKEN`, value: your token
|
|
22
|
-
|
|
23
|
-
## Step 3: Create the versioning workflow
|
|
7
|
+
## Step 1: Create the versioning workflow
|
|
24
8
|
|
|
25
9
|
`.github/workflows/version.yml`:
|
|
26
10
|
|
|
@@ -30,6 +14,9 @@ on:
|
|
|
30
14
|
push:
|
|
31
15
|
branches: [main]
|
|
32
16
|
|
|
17
|
+
permissions:
|
|
18
|
+
contents: write
|
|
19
|
+
|
|
33
20
|
jobs:
|
|
34
21
|
version:
|
|
35
22
|
runs-on: ubuntu-latest
|
|
@@ -44,13 +31,32 @@ jobs:
|
|
|
44
31
|
|
|
45
32
|
- name: Create version tag
|
|
46
33
|
env:
|
|
47
|
-
|
|
34
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
48
35
|
run: npx @logickernel/agileflow github
|
|
49
36
|
```
|
|
50
37
|
|
|
38
|
+
That's it. The `permissions: contents: write` block grants the token permission to create tags, and the `env` block makes it available to AgileFlow. No custom tokens or secrets setup needed.
|
|
39
|
+
|
|
51
40
|
`fetch-depth: 0` is required — without it, AgileFlow can only see a shallow clone and cannot find the last version tag.
|
|
52
41
|
|
|
53
|
-
|
|
42
|
+
### Using a Personal Access Token instead
|
|
43
|
+
|
|
44
|
+
If your organization restricts `GITHUB_TOKEN` permissions or you need cross-repository tagging, use a PAT:
|
|
45
|
+
|
|
46
|
+
1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
|
|
47
|
+
2. Click **Generate new token**
|
|
48
|
+
3. Set:
|
|
49
|
+
- **Name**: `AgileFlow`
|
|
50
|
+
- **Repository access**: your repository
|
|
51
|
+
- **Permissions**: `Contents: Read and write`
|
|
52
|
+
4. Copy the token
|
|
53
|
+
5. In your repository: **Settings → Secrets and variables → Actions**
|
|
54
|
+
6. Click **New repository secret**
|
|
55
|
+
7. Name: `AGILEFLOW_TOKEN`, value: your token
|
|
56
|
+
|
|
57
|
+
AgileFlow checks `AGILEFLOW_TOKEN` first, then falls back to `GITHUB_TOKEN`. When `AGILEFLOW_TOKEN` is set, no `permissions` block is needed.
|
|
58
|
+
|
|
59
|
+
## Step 3: Create the release workflow
|
|
54
60
|
|
|
55
61
|
`.github/workflows/release.yml`:
|
|
56
62
|
|
|
@@ -99,9 +105,9 @@ If no bump is needed (all commits are `chore`, `docs`, etc.), AgileFlow exits wi
|
|
|
99
105
|
|
|
100
106
|
## Troubleshooting
|
|
101
107
|
|
|
102
|
-
**"
|
|
108
|
+
**"No authentication token found"** — Neither `AGILEFLOW_TOKEN` nor `GITHUB_TOKEN` is available. If running in GitHub Actions, ensure the workflow has `permissions: contents: write`. If using a PAT, verify the `AGILEFLOW_TOKEN` secret exists.
|
|
103
109
|
|
|
104
|
-
**"Resource not accessible by integration" / 403** — The token lacks `
|
|
110
|
+
**"Resource not accessible by integration" / 403** — The token lacks `contents: write` permission. Add `permissions: contents: write` to your workflow, or regenerate your PAT with the correct scope.
|
|
105
111
|
|
|
106
112
|
**"Bad credentials" / 401** — The token has expired or was revoked. Regenerate and update the secret.
|
|
107
113
|
|
package/package.json
CHANGED
package/src/github-push.js
CHANGED
|
@@ -131,17 +131,20 @@ function makeRequest({ method, path, accessToken, body }) {
|
|
|
131
131
|
* @returns {Promise<void>}
|
|
132
132
|
*/
|
|
133
133
|
async function pushTag(tagName, message, remote = 'origin') {
|
|
134
|
-
const accessToken = process.env.AGILEFLOW_TOKEN;
|
|
134
|
+
const accessToken = process.env.AGILEFLOW_TOKEN || process.env.GITHUB_TOKEN;
|
|
135
135
|
const repository = process.env.GITHUB_REPOSITORY;
|
|
136
136
|
const commitSha = process.env.GITHUB_SHA;
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
if (!accessToken) {
|
|
139
139
|
throw new Error(
|
|
140
|
-
`
|
|
141
|
-
`
|
|
142
|
-
`
|
|
143
|
-
`
|
|
144
|
-
`
|
|
140
|
+
`No authentication token found.\n\n` +
|
|
141
|
+
`AgileFlow looks for AGILEFLOW_TOKEN or GITHUB_TOKEN (in that order).\n\n` +
|
|
142
|
+
`In GitHub Actions, GITHUB_TOKEN is available automatically — just add\n` +
|
|
143
|
+
`permissions to your workflow:\n` +
|
|
144
|
+
` permissions:\n` +
|
|
145
|
+
` contents: write\n\n` +
|
|
146
|
+
`Or use a Personal Access Token with "contents: write" permission\n` +
|
|
147
|
+
`and store it as a secret named AGILEFLOW_TOKEN.`
|
|
145
148
|
);
|
|
146
149
|
}
|
|
147
150
|
|
package/src/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ const { execSync } = require('child_process');
|
|
|
11
11
|
*/
|
|
12
12
|
function runWithOutput(command, options = {}) {
|
|
13
13
|
try {
|
|
14
|
-
return execSync(command, { stdio: 'pipe', encoding: 'utf8', ...options });
|
|
14
|
+
return execSync(command, { stdio: 'pipe', encoding: 'utf8', maxBuffer: 50 * 1024 * 1024, ...options });
|
|
15
15
|
} catch (error) {
|
|
16
16
|
const captured = {
|
|
17
17
|
stdout: error?.stdout ? String(error.stdout) : '',
|