Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: tracking from config #4

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4cba61c
feat!: changed configuration to take a repo list
gentlementlegen Jul 28, 2024
ea07e5e
chore: changed pull request fetch
gentlementlegen Jul 28, 2024
cba2f9f
feat!: removed database and scrap GitHub organizations and repos
gentlementlegen Jul 29, 2024
8479b7a
chore: added tests for closing tasks
gentlementlegen Jul 29, 2024
17e2605
chore: added action.yml
gentlementlegen Jul 29, 2024
e00f5a5
chore: added start command
gentlementlegen Jul 29, 2024
cf67f7b
chore: added tsx for prod
gentlementlegen Jul 29, 2024
e5a327f
chore: changed main.ts to index.ts
gentlementlegen Jul 29, 2024
f2d57d1
chore: not running if no repo in config
gentlementlegen Jul 29, 2024
29a9e34
chore: added secrets env
gentlementlegen Jul 29, 2024
377eba2
chore: removed console log
gentlementlegen Jul 29, 2024
4b2cc85
chore: remove Jest env var
gentlementlegen Jul 29, 2024
42c041c
chore: remove Jest env var
gentlementlegen Jul 29, 2024
fb88f90
chore: fixed close PR test
gentlementlegen Jul 31, 2024
58182e6
feat: changed configuration for repo watch
gentlementlegen Aug 2, 2024
9b70450
chore: fix test
gentlementlegen Aug 3, 2024
6357b1f
chore: changed get call to use rest api
gentlementlegen Aug 5, 2024
35960c2
chore: changed parse target to use the context payload
gentlementlegen Aug 5, 2024
5627ca7
chore: fixed tests
gentlementlegen Aug 5, 2024
c2e7c8e
chore: added back pagination on search request
gentlementlegen Aug 7, 2024
6f846c7
chore: rethrow error on search fail and added related test
gentlementlegen Aug 7, 2024
3d653df
chore: fixed owner login string instead of object
gentlementlegen Aug 13, 2024
a4ab6dc
chore: lowered complexity for updatePullRequests
gentlementlegen Aug 14, 2024
d404c11
chore: typeguard for issue event
gentlementlegen Aug 18, 2024
b6b4f0e
chore: added OWNER as a collborator status
gentlementlegen Aug 18, 2024
0b2c0ba
chore: throw error if no owner is set
gentlementlegen Aug 18, 2024
ef5d54f
chore: added organization as default monitor if none is provided
gentlementlegen Aug 18, 2024
be71bf9
chore: destructure logger from context
gentlementlegen Aug 18, 2024
f1632a9
chore: fixed cspell
gentlementlegen Aug 18, 2024
7bc1e42
chore: config now accepts repo or org/repo patterns
gentlementlegen Aug 19, 2024
5c4e011
chore: added issues_comment.created as a listener
gentlementlegen Aug 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "./src/adapters/supabase/**/**.ts"],
"ignorePaths": ["**/*.json", "**/*.css", "node_modules", "**/*.log", "./src/adapters/supabase/**/**.ts", "eslint.config.mjs"],
"useGitignore": true,
"language": "en",
"words": ["Nektos", "dataurl", "devpool", "outdir", "servedir", "Supabase", "SUPABASE", "typebox", "ubiquibot", "Smee", "typeorm", "timespan", "mswjs"],
Expand Down
56 changes: 1 addition & 55 deletions .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ on:
ref:
description: "Ref"

# Limits to one job at a time
#concurrency:
# group: ${{ github.workflow }}

jobs:
compute:
name: "Automated Merging"
Expand All @@ -41,56 +37,6 @@ jobs:
shell: cat {0}

- name: Execute directive
run: npx tsx ./src/main.ts
id: automated-merging
uses: ./
gentlementlegen marked this conversation as resolved.
Show resolved Hide resolved
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Will try to upload the changes made within the DB during the run.
# If all tries fail, an artifact containing the db is uploaded.
- name: Commit and Push DB updates with Retry
id: commit_and_push
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git config --global pull.rebase false
git add database/sql.db

attempts=0
max_attempts=10
success=false

while [ $attempts -lt $max_attempts ]; do
if [ -n "$(git diff-index --cached --name-only HEAD)" ]; then
if git commit -m "chore: [skip ci] updated database"; then
git pull -X ours
if git push origin main; then
success=true
break
fi
else
echo "Commit failed, retrying..."
fi
else
echo "No changes to commit"
success=true
break
fi
attempts=$((attempts + 1))
echo "Attempt $attempts/$max_attempts failed, retrying in 10 seconds..."
sleep 10
done

if [ "$success" = false ]; then
echo "Failed to commit and push changes after $max_attempts attempts" | tee failure.log
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Failure Log
if: steps.commit_and_push.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: sql.db
path: database/sql.db
2 changes: 0 additions & 2 deletions .github/workflows/jest-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:

- name: Jest With Coverage
run: yarn install --immutable --immutable-cache --check-cache && yarn test
env:
GITHUB_TOKEN: "gh_token"

- name: Add Jest Report to Summary
if: always()
Expand Down
16 changes: 16 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Automated Merging"
description: "Watch user's activity."
outputs:
result:
description: "Conditionally merge pull requests after a timeout."
value: ${{ steps.main.outputs.result }}
runs:
using: "composite"
steps:
- run: |
yarn --cwd ${{ github.action_path }} --production=true
id: install
shell: bash
gentlementlegen marked this conversation as resolved.
Show resolved Hide resolved
- run: yarn --cwd ${{ github.action_path }} start
shell: bash
id: main
Binary file removed database/sql.db
Binary file not shown.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Automated merging",
"description": "Automatically merge pull-requests.",
"ubiquity:listeners": [ "push", "pull_request.opened", "pull_request.reopened" ]
"ubiquity:listeners": [ "push", "issues_comment.created" ]
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Conditionally merge pull requests after a timeout.",
"author": "Ubiquity DAO",
"license": "MIT",
"main": "src/main.ts",
"main": "src/index.ts",
"engines": {
"node": ">=20.10.0"
},
Expand All @@ -16,6 +16,7 @@
"knip": "knip --config .github/knip.ts",
"knip-ci": "knip --no-exit-code --reporter json --config .github/knip.ts",
"prepare": "husky install",
"start": "tsx src/index.ts",
"test": "jest --setupFiles dotenv/config --coverage"
},
"keywords": [
Expand All @@ -28,17 +29,17 @@
"dependencies": {
"@actions/core": "1.10.1",
"@actions/github": "6.0.0",
"@octokit/plugin-paginate-rest": "11.3.1",
"@octokit/rest": "20.1.1",
"@octokit/webhooks": "13.2.7",
"@sinclair/typebox": "0.32.33",
"@ubiquity-dao/ubiquibot-logger": "1.2.0",
"dotenv": "16.4.5",
"ms": "2.1.3",
"reflect-metadata": "0.2.2",
"sqlite3": "5.1.7",
"ts-retry": "4.2.5",
"typebox-validators": "0.3.5",
"typeorm": "0.3.20"
"tsx": "4.16.2",
"typebox-validators": "0.3.5"
},
"devDependencies": {
"@commitlint/cli": "19.3.0",
Expand Down Expand Up @@ -67,7 +68,6 @@
"npm-run-all": "4.1.5",
"prettier": "3.3.2",
"ts-jest": "29.1.5",
"tsx": "4.15.6",
"typescript": "5.4.5",
"typescript-eslint": "7.13.1"
},
Expand Down
11 changes: 0 additions & 11 deletions src/adapters/index.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/adapters/sqlite/data-source.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/adapters/sqlite/entities/pull-request.ts

This file was deleted.

47 changes: 0 additions & 47 deletions src/adapters/sqlite/helpers/pull-request-adapter.ts

This file was deleted.

12 changes: 0 additions & 12 deletions src/adapters/sqlite/helpers/sqlite.ts

This file was deleted.

15 changes: 0 additions & 15 deletions src/handlers/pull-request-opened.ts

This file was deleted.

Loading