@logickernel/agileflow 0.20.0 → 0.21.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 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
@@ -74,12 +77,10 @@ jobs:
74
77
  node-version: '20'
75
78
 
76
79
  - name: Create version tag
77
- env:
78
- AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
79
80
  run: npx @logickernel/agileflow github
80
81
  ```
81
82
 
82
- Requires an `AGILEFLOW_TOKEN` secret — a Personal Access Token with `Contents: Read and write` permission.
83
+ AgileFlow automatically uses the built-in `GITHUB_TOKEN` — no secrets or custom tokens needed. Just grant `contents: write` permission in the workflow. You can also use a [Personal Access Token](./docs/guides/github-actions.md) if your organization restricts `GITHUB_TOKEN` permissions.
83
84
 
84
85
  ### GitLab CI
85
86
 
@@ -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 an access token
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
@@ -43,14 +30,31 @@ jobs:
43
30
  node-version: '20'
44
31
 
45
32
  - name: Create version tag
46
- env:
47
- AGILEFLOW_TOKEN: ${{ secrets.AGILEFLOW_TOKEN }}
48
33
  run: npx @logickernel/agileflow github
49
34
  ```
50
35
 
36
+ That's it. AgileFlow automatically picks up the `GITHUB_TOKEN` that GitHub Actions provides. The `permissions: contents: write` block grants it permission to create tags.
37
+
51
38
  `fetch-depth: 0` is required — without it, AgileFlow can only see a shallow clone and cannot find the last version tag.
52
39
 
53
- ## Step 4: Create the release workflow
40
+ ### Using a Personal Access Token instead
41
+
42
+ If your organization restricts `GITHUB_TOKEN` permissions or you need cross-repository tagging, use a PAT:
43
+
44
+ 1. Go to **Settings → Developer settings → Personal access tokens → Fine-grained tokens**
45
+ 2. Click **Generate new token**
46
+ 3. Set:
47
+ - **Name**: `AgileFlow`
48
+ - **Repository access**: your repository
49
+ - **Permissions**: `Contents: Read and write`
50
+ 4. Copy the token
51
+ 5. In your repository: **Settings → Secrets and variables → Actions**
52
+ 6. Click **New repository secret**
53
+ 7. Name: `AGILEFLOW_TOKEN`, value: your token
54
+
55
+ AgileFlow checks `AGILEFLOW_TOKEN` first, then falls back to `GITHUB_TOKEN`. When `AGILEFLOW_TOKEN` is set, no `permissions` block is needed.
56
+
57
+ ## Step 3: Create the release workflow
54
58
 
55
59
  `.github/workflows/release.yml`:
56
60
 
@@ -99,9 +103,9 @@ If no bump is needed (all commits are `chore`, `docs`, etc.), AgileFlow exits wi
99
103
 
100
104
  ## Troubleshooting
101
105
 
102
- **"AGILEFLOW_TOKEN not set"** — The secret is missing or not passed via `env:`. Verify the secret exists and the `env:` block is present in the step.
106
+ **"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
107
 
104
- **"Resource not accessible by integration" / 403** — The token lacks `Contents: Read and write` permission. Regenerate with the correct scope.
108
+ **"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
109
 
106
110
  **"Bad credentials" / 401** — The token has expired or was revoked. Regenerate and update the secret.
107
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logickernel/agileflow",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Automatic semantic versioning and changelog generation based on conventional commits",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -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
- `AGILEFLOW_TOKEN environment variable is required but not set.\n\n` +
141
- `To fix this:\n` +
142
- `1. Create a Personal Access Token with "contents: write" permission\n` +
143
- `2. Add it as a repository secret named AGILEFLOW_TOKEN\n` +
144
- `3. In your workflow, add: env: AGILEFLOW_TOKEN: \${{ secrets.AGILEFLOW_TOKEN }}`
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