ソースを参照

Merge pull request #133 from RooVetGit/chores/remove-ai-releases

Remove AI releases
Abel Trejo Pineda 1 年間 前
コミット
476e564c23

+ 20 - 0
.changeset/changelog-config.ts

@@ -0,0 +1,20 @@
+import { ChangelogFunctions } from '@changesets/types';
+
+const getReleaseLine: ChangelogFunctions['getReleaseLine'] = async (changeset) => {
+  const [firstLine] = changeset.summary
+    .split('\n')
+    .map(l => l.trim())
+    .filter(Boolean);
+  return `-   ${firstLine}`;
+};
+
+const getDependencyReleaseLine: ChangelogFunctions['getDependencyReleaseLine'] = async () => {
+  return '';
+};
+
+const changelogFunctions: ChangelogFunctions = {
+  getReleaseLine,
+  getDependencyReleaseLine,
+};
+
+export default changelogFunctions;

+ 1 - 1
.changeset/config.json

@@ -1,6 +1,6 @@
 {
 {
   "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
   "$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
-  "changelog": "@changesets/cli/changelog",
+  "changelog": "./changelog-config.ts",
   "commit": false,
   "commit": false,
   "fixed": [],
   "fixed": [],
   "linked": [],
   "linked": [],

+ 6 - 9
.github/actions/ai-release-notes/action.yml

@@ -20,17 +20,14 @@ inputs:
     default: ''
     default: ''
     type: string
     type: string
   git_ref:
   git_ref:
-    required: false
+    required: true
     type: string
     type: string
-    default: ''
   head_ref:
   head_ref:
-    required: false
+    required: true
     type: string
     type: string
-    default: main
   base_ref:
   base_ref:
-    required: false
+    required: true
     type: string
     type: string
-    default: main
 
 
 outputs:
 outputs:
   RELEASE_NOTES:
   RELEASE_NOTES:
@@ -41,9 +38,9 @@ outputs:
     value: ${{ steps.ai_prompt.outputs.OPENAI_PROMPT }}
     value: ${{ steps.ai_prompt.outputs.OPENAI_PROMPT }}
 
 
 env:
 env:
-  GITHUB_REF: ${{ inputs.git_ref == '' && github.event.pull_request.head.ref || inputs.git_ref }}
-  BASE_REF: ${{ inputs.base_ref == '' && github.base_ref || inputs.base_ref }}
-  HEAD_REF: ${{ inputs.head_ref == '' && github.event.pull_request.head.sha || inputs.head_ref }}
+  GITHUB_REF: ${{ inputs.git_ref }}
+  BASE_REF: ${{ inputs.base_ref }}
+  HEAD_REF: ${{ inputs.head_ref }}
 
 
 runs:
 runs:
   using: "composite"
   using: "composite"

+ 0 - 216
.github/workflows/changeset-ai-releases.yml

@@ -1,216 +0,0 @@
-name: Changeset AI Release
-run-name: Changeset AI Release ${{ github.actor != 'R00-B0T' && '- Create PR' || '- Approve & Release' }}
-
-# This workflow automates the release process by:
-# 1. Creating a version bump PR when changesets are merged to main
-# 2. Using AI to generate release notes for the version bump PR
-# 3. Auto-approving and merging the version bump PR
-# 4. Creating a GitHub release with the AI-generated notes
-
-on:
-  # pull_request:
-  #   types: [closed, opened, synchronize, labeled]
-  workflow_dispatch:
-
-env:
-  REPO_PATH: ${{ github.repository }}
-  GIT_REF: ${{ github.event.pull_request.head.sha }}
-
-jobs:
-  # Job 1: Create version bump PR when changesets are merged to main
-  changeset-pr-version-bump:
-    if: >
-      github.event_name == 'pull_request' &&
-      github.event.pull_request.merged == true &&
-      github.event.pull_request.base.ref == 'main' &&
-      github.actor != 'R00-B0T'
-    runs-on: ubuntu-latest
-    permissions:
-      contents: write
-      pull-requests: write
-    steps:
-      - name: Git Checkout
-        uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
-          ref: ${{ env.GIT_REF }}
-
-      - name: Setup Node.js
-        uses: actions/setup-node@v4
-        with:
-          node-version: 20
-          cache: 'npm'
-            
-      - name: Install Dependencies
-        run: npm install
-
-      # Check if there are any new changesets to process
-      - name: Check for changesets
-        id: check-changesets
-        run: |
-          NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
-          echo "Changesets diff with previous version: $NEW_CHANGESETS"
-          echo "new_changesets=$NEW_CHANGESETS" >> $GITHUB_OUTPUT
-
-      # Create version bump PR using changesets/action if there are new changesets
-      - name: Changeset Pull Request
-        if: steps.check-changesets.outputs.new_changesets != '0'
-        id: changesets
-        uses: changesets/action@v1
-        with:
-          commit: "changeset version bump"
-          title: "Changeset version bump"
-          version: npm run version-packages # This performs the changeset version bump
-        env:
-          GITHUB_TOKEN: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
-
-  # Job 2: Process version bump PR created by R00-B0T
-  changeset-pr-approve-merge:
-    name: Auto approve and merge Bump version PRs
-    runs-on: ubuntu-latest
-    permissions:
-      contents: write
-      pull-requests: write
-    if: >
-        github.event_name == 'pull_request' &&
-        github.event.pull_request.base.ref == 'main' &&
-        github.actor == 'R00-B0T' &&
-        contains(github.event.pull_request.title, 'Changeset version bump')
-    
-    steps:
-      - name: Checkout Repo
-        uses: actions/checkout@v4
-        with:
-          token: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
-          fetch-depth: 0
-          ref: ${{ env.GIT_REF }}
-
-      # Get current and previous versions for changelog processing
-      - name: Get version
-        id: get_version
-        run: |
-          VERSION=$(git show HEAD:package.json | jq -r '.version')
-          echo "version=$VERSION" >> $GITHUB_OUTPUT
-          PREV_VERSION=$(git show origin/main:package.json | jq -r '.version')
-          echo "prev_version=$PREV_VERSION" >> $GITHUB_OUTPUT
-
-          echo "version=$VERSION"
-          echo "prev_version=$PREV_VERSION"
-
-      # Get previous version refs, GITHUB_OUTPUT: 'BASE_REF' and 'HEAD_REF'
-      - name: Get Previous Version Refs
-        id: version_refs
-        run: python .github/scripts/get_prev_version_refs.py
-
-      # Generate release notes using OpenAI if not already edited, GITHUB_OUTPUT: 'RELEASE_NOTES' and 'OPENAI_PROMPT'
-      - name: AI Release Notes
-        if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}
-        uses: ./.github/actions/ai-release-notes
-        id: ai_release_notes
-        with:
-          GHA_PAT: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
-          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
-          model_name: gpt-4o-mini
-          repo_path: ${{ env.REPO_PATH }}
-          base_ref: ${{ steps.version_refs.outputs.base_ref }}
-          head_ref: ${{ steps.version_refs.outputs.head_ref }}
-
-      # Update CHANGELOG.md with AI-generated notes
-      - name: Update Changeset Changelog
-        if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}
-        env:
-          VERSION: ${{ steps.get_version.outputs.version }}
-          PREV_VERSION: ${{ steps.get_version.outputs.prev_version }}
-          NEW_CONTENT: ${{ steps.ai_release_notes.outputs.RELEASE_NOTES }}
-        run: python .github/scripts/overwrite_changeset_changelog.py
-
-      # Commit and push changelog updates
-      - name: Push Changelog updates
-        if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}
-        run: |
-          git config user.name "R00-B0T"
-          git config user.email [email protected]
-          git status
-
-          echo "Updating changelog.md..."
-          git add CHANGELOG.md
-          git commit -m "Updating changeset changelog"
-
-          echo "--------------------------------------------------------------------------------"
-          echo "Pushing to remote..."
-          echo "--------------------------------------------------------------------------------"
-          git push
-
-      # Add label to indicate OpenAI has processed this PR
-      - name: Add openai-edited label
-        if: ${{ !contains(github.event.pull_request.labels.*.name, 'openai-edited') }}
-        uses: actions/github-script@v7
-        with:
-          github-token: ${{ secrets.GITHUB_TOKEN }}
-          script: |
-            await github.rest.issues.addLabels({
-              owner: context.repo.owner,
-              repo: context.repo.repo,
-              issue_number: context.issue.number,
-              labels: ['openai-edited']
-            });
-
-      # Auto-approve PR once OpenAI has processed it
-      - name: Auto approve PR
-        if: contains(github.event.pull_request.labels.*.name, 'openai-edited')
-        uses: hmarr/auto-approve-action@v4
-        with:
-          review-message: "I'm approving since it's a bump version PR"
-
-      # Enable auto-merge for the PR
-      - name: Enable automerge on PR
-        if: contains(github.event.pull_request.labels.*.name, 'openai-edited')
-        run: gh pr merge --squash --auto ${{ github.event.pull_request.number }}
-        env:
-          GH_TOKEN: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
-  
-  # Job 3: Create GitHub release after version bump PR is merged
-  github-release:
-    runs-on: ubuntu-latest
-    if: >
-        github.event_name == 'pull_request' &&
-        github.event.pull_request.merged == true &&
-        github.event.pull_request.base.ref == 'main' &&
-        github.actor == 'R00-B0T' &&
-        contains(github.event.pull_request.title, 'Changeset version bump')
-    permissions:
-      contents: write
-    steps:
-      - name: Checkout Repo
-        uses: actions/checkout@v4
-        with:
-          ref: ${{ github.event.pull_request.head.sha }}
-          fetch-depth: 0
-
-      - name: Get version
-        id: get_version
-        run: |
-          VERSION=$(git show HEAD:package.json | jq -r '.version')
-          echo "version=$VERSION" >> $GITHUB_OUTPUT
-
-      # Extract release notes from CHANGELOG.md, GITHUB_OUTPUT: 'release-notes'
-      - name: Parse CHANGELOG.md
-        id: changelog
-        env:
-          CHANGELOG_PATH: CHANGELOG.md
-          VERSION: ${{ steps.get_version.outputs.version }}
-        run: python .github/scripts/parse_changeset_changelog.py
-
-      # Create GitHub release with extracted notes
-      - name: Create or Update Release
-        uses: softprops/action-gh-release@v2
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          tag_name: v${{ steps.get_version.outputs.version }}
-          name: Release v${{ steps.get_version.outputs.version }}
-          draft: false
-          prerelease: false
-          append_body: false
-          make_latest: true
-          body: ${{ steps.changelog.outputs.release-notes }}

+ 91 - 0
.github/workflows/changeset-release.yml

@@ -0,0 +1,91 @@
+name: Changeset Release
+run-name: Changeset Release ${{ github.actor != 'R00-B0T' && '- Create PR' || '- Approve & Merge' }}
+
+on:
+  pull_request:
+    types: [closed, opened, synchronize, labeled]
+
+env:
+  REPO_PATH: ${{ github.repository }}
+  GIT_REF: ${{ github.event.pull_request.head.sha }}
+
+jobs:
+  # Job 1: Create version bump PR when changesets are merged to main
+  changeset-pr-version-bump:
+    if: >
+      github.event_name == 'pull_request' &&
+      github.event.pull_request.merged == true &&
+      github.event.pull_request.base.ref == 'main' &&
+      github.actor != 'R00-B0T'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+    steps:
+      - name: Git Checkout
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+          ref: ${{ env.GIT_REF }}
+
+      - name: Setup Node.js
+        uses: actions/setup-node@v4
+        with:
+          node-version: 20
+          cache: 'npm'
+            
+      - name: Install Dependencies
+        run: npm install
+
+      # Check if there are any new changesets to process
+      - name: Check for changesets
+        id: check-changesets
+        run: |
+          NEW_CHANGESETS=$(find .changeset -name "*.md" ! -name "README.md" | wc -l | tr -d ' ')
+          echo "Changesets diff with previous version: $NEW_CHANGESETS"
+          echo "new_changesets=$NEW_CHANGESETS" >> $GITHUB_OUTPUT
+
+      # Create version bump PR using changesets/action if there are new changesets
+      - name: Changeset Pull Request
+        if: steps.check-changesets.outputs.new_changesets != '0'
+        id: changesets
+        uses: changesets/action@v1
+        with:
+          commit: "changeset version bump"
+          title: "Changeset version bump"
+          version: npm run version-packages # This performs the changeset version bump
+        env:
+          GITHUB_TOKEN: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
+
+  # Job 2: Process version bump PR created by R00-B0T
+  changeset-pr-approve-merge:
+    name: Auto approve and merge Bump version PRs
+    runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
+    if: >
+        github.event_name == 'pull_request' &&
+        github.event.pull_request.base.ref == 'main' &&
+        github.actor == 'R00-B0T' &&
+        contains(github.event.pull_request.title, 'Changeset version bump')
+    
+    steps:
+      - name: Checkout Repo
+        uses: actions/checkout@v4
+        with:
+          token: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}
+          fetch-depth: 0
+          ref: ${{ env.GIT_REF }}
+
+      # Auto-approve PR
+      - name: Auto approve PR
+        uses: hmarr/auto-approve-action@v4
+        with:
+          review-message: "I'm approving since it's a bump version PR"
+
+      # Enable auto-merge for the PR
+      - name: Enable automerge on PR
+        run: gh pr merge --squash --auto ${{ github.event.pull_request.number }}
+        env:
+          GH_TOKEN: ${{ secrets.CROSS_REPO_ACCESS_TOKEN }}

+ 3 - 0
.gitignore

@@ -8,3 +8,6 @@ node_modules
 # Builds
 # Builds
 bin/
 bin/
 roo-cline-*.vsix
 roo-cline-*.vsix
+
+# Local prompts and rules
+/local-prompts

+ 1 - 0
package-lock.json

@@ -46,6 +46,7 @@
       },
       },
       "devDependencies": {
       "devDependencies": {
         "@changesets/cli": "^2.27.10",
         "@changesets/cli": "^2.27.10",
+        "@changesets/types": "^6.0.0",
         "@types/diff": "^5.2.1",
         "@types/diff": "^5.2.1",
         "@types/jest": "^29.5.14",
         "@types/jest": "^29.5.14",
         "@types/mocha": "^10.0.7",
         "@types/mocha": "^10.0.7",

+ 1 - 0
package.json

@@ -172,6 +172,7 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "@changesets/cli": "^2.27.10",
     "@changesets/cli": "^2.27.10",
+    "@changesets/types": "^6.0.0",
     "@types/diff": "^5.2.1",
     "@types/diff": "^5.2.1",
     "@types/jest": "^29.5.14",
     "@types/jest": "^29.5.14",
     "@types/mocha": "^10.0.7",
     "@types/mocha": "^10.0.7",