Skip to content

Commit

Permalink
chore: changed conditions for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Nov 24, 2024
1 parent 5c2ec98 commit e26a4f6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 68 deletions.
55 changes: 7 additions & 48 deletions .github/workflows/update-configuration.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,20 @@
name: "Update Configuration"
name: "Update Configuration and Build"

on:
workflow_dispatch:
push:

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 }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/types/plugin-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
8 changes: 3 additions & 5 deletions src/utils/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
20 changes: 7 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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

Expand Down

0 comments on commit e26a4f6

Please sign in to comment.