diff --git a/.github/workflows/update-configuration.yml b/.github/workflows/update-configuration.yml index 2dac9e54..ba13ebdf 100644 --- a/.github/workflows/update-configuration.yml +++ b/.github/workflows/update-configuration.yml @@ -1,4 +1,4 @@ -name: "Update Configuration" +name: "Update Configuration and Build" on: workflow_dispatch: @@ -6,56 +6,15 @@ on: jobs: update: - name: "Update Configuration in manifest.json" + name: "Update Configuration & Build" runs-on: ubuntu-latest permissions: write-all steps: - - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: "20.10.0" - - - name: Enable corepack - run: corepack enable - - - name: Install deps and run configuration update - run: | - yarn install - yarn tsc --noCheck --project tsconfig.json - - - name: Update manifest configuration using GitHub Script - uses: actions/github-script@v7 + - uses: ubiquity-os/action-deploy-plugin@main with: - script: | - const fs = require('fs'); - const path = require('path'); - - const { pluginSettingsSchema } = require('./src/types/plugin-input'); - - const manifestPath = path.resolve("${{ github.workspace }}", './manifest.json'); - const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); - - const configuration = JSON.stringify(pluginSettingsSchema); - - manifest["configuration"] = JSON.parse(configuration); - - const updatedManifest = JSON.stringify(manifest, null, 2); - console.log('Updated manifest:', updatedManifest); - fs.writeFileSync(manifestPath, updatedManifest); - - - name: Commit and Push generated types - run: | - git config --global user.name 'ubiquity-os[bot]' - git config --global user.email 'ubiquity-os[bot]@users.noreply.github.com' - git add ./manifest.json - if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then - git commit -m "chore: updated generated configuration" || echo "Lint-staged check failed" - git push origin HEAD:${{ github.ref_name }} - else - echo "No changes to commit" - fi + treatAsEsm: false + sourcemap: false env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/package.json b/package.json index 543f860a..01f21610 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@octokit/types": "^13.6.1", "@sinclair/typebox": "0.34.3", "@supabase/supabase-js": "2.42.0", - "@ubiquity-os/plugin-sdk": "^1.0.11", + "@ubiquity-os/plugin-sdk": "^1.1.0", "@ubiquity-os/ubiquity-os-logger": "^1.3.2", "dotenv": "^16.4.4", "ms": "^2.1.3" diff --git a/src/types/plugin-input.ts b/src/types/plugin-input.ts index 581674f4..428fc721 100644 --- a/src/types/plugin-input.ts +++ b/src/types/plugin-input.ts @@ -39,7 +39,7 @@ function maxConcurrentTasks() { export const pluginSettingsSchema = T.Object( { - reviewDelayTolerance: T.String({ default: "1 Day" }), + reviewDelayTolerance: T.String({ default: "1 Day", description: "How long shall the wait be for a reviewer to take action?" }), taskStaleTimeoutDuration: T.String({ default: "30 Days" }), startRequiresWallet: T.Boolean({ default: true }), maxConcurrentTasks: maxConcurrentTasks(), diff --git a/src/utils/issue.ts b/src/utils/issue.ts index 5d34a903..22349cf9 100644 --- a/src/utils/issue.ts +++ b/src/utils/issue.ts @@ -261,11 +261,9 @@ export async function getAvailableOpenedPullRequests(context: Context, username: const { owner, repo } = getOwnerRepoFromHtmlUrl(openedPullRequest.html_url); const reviews = await getAllPullRequestReviews(context, openedPullRequest.number, owner, repo); - if (reviews.length > 0) { - const approvedReviews = reviews.find((review) => review.state === "APPROVED"); - if (approvedReviews) { - result.push(openedPullRequest); - } + if (!reviews.length || (reviews.length > 0 && reviews.some((review) => review.state === "CHANGES_REQUESTED"))) { + result.push(openedPullRequest); + continue; } if (reviews.length === 0 && new Date().getTime() - new Date(openedPullRequest.created_at).getTime() >= getTimeValue(reviewDelayTolerance)) { diff --git a/yarn.lock b/yarn.lock index 8102cf98..97337db3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2574,13 +2574,6 @@ __metadata: languageName: node linkType: hard -"@sinclair/typebox@npm:^0.33.21": - version: 0.33.22 - resolution: "@sinclair/typebox@npm:0.33.22" - checksum: 10c0/8c50b8295e0af8477e6cb5102c18a9d37d890ce08600b72d21273f5ed85183e1d9e83bb4b49aab7ff5e85e9c4b40605c1110ff6f99a08e562d6b10b38ea214a5 - languageName: node - linkType: hard - "@sinonjs/commons@npm:^3.0.0": version: 3.0.1 resolution: "@sinonjs/commons@npm:3.0.1" @@ -3078,7 +3071,7 @@ __metadata: "@types/jest": "npm:29.5.12" "@types/ms": "npm:^0.7.34" "@types/node": "npm:20.14.5" - "@ubiquity-os/plugin-sdk": "npm:^1.0.11" + "@ubiquity-os/plugin-sdk": "npm:^1.1.0" "@ubiquity-os/ubiquity-os-logger": "npm:^1.3.2" cspell: "npm:8.9.0" dotenv: "npm:^16.4.4" @@ -3105,9 +3098,9 @@ __metadata: languageName: unknown linkType: soft -"@ubiquity-os/plugin-sdk@npm:^1.0.11": - version: 1.0.11 - resolution: "@ubiquity-os/plugin-sdk@npm:1.0.11" +"@ubiquity-os/plugin-sdk@npm:^1.1.0": + version: 1.1.0 + resolution: "@ubiquity-os/plugin-sdk@npm:1.1.0" dependencies: "@actions/core": "npm:^1.11.1" "@actions/github": "npm:^6.0.0" @@ -3120,11 +3113,12 @@ __metadata: "@octokit/rest": "npm:^21.0.2" "@octokit/types": "npm:^13.6.1" "@octokit/webhooks": "npm:^13.3.0" - "@sinclair/typebox": "npm:^0.33.21" "@ubiquity-os/ubiquity-os-logger": "npm:^1.3.2" dotenv: "npm:^16.4.5" hono: "npm:^4.6.9" - checksum: 10c0/5ca06ead4ce0cd6e9bb2c4e353860904d1a5a8621b8ec03c9362ac6dc1e2a79b1d5d730e529cc03fb4d976eebf1f80e694e13997b90a188301da6daf56e1ac53 + peerDependencies: + "@sinclair/typebox": 0.34.3 + checksum: 10c0/ee7ea78eb2ae4644ee7dc9b94651793f5a591ad0203532269276a705e4c85fe68fbccffb3f97d9aaa6c969dd67defd474729421fc3a4dd9ff678c601d6bb2638 languageName: node linkType: hard