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

Add dependabot and automerge support #71

Merged
merged 14 commits into from
Apr 3, 2024
24 changes: 24 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
commit-message:
prefix: feat
include: scope
allow:
- dependency-type: production
ignore:
- dependency-name: '*'
update-types:
- 'version-update:semver-major'
groups:
seam:
dependency-type: development
patterns:
- '@seamapi/types'
update-types:
- patch
- minor
71 changes: 71 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: Automerge

on:
pull_request:
branches:
- main

jobs:
changes:
name: Get changes for #${{ github.event.number }}
runs-on: ubuntu-latest
timeout-minutes: 30
# if: github.actor == 'dependabot[bot]'
permissions:
checks: read
outputs:
has_changes: ${{ steps.changed.outputs.any_changed == 'true' && steps.checks.outputs.conclusion == 'success'}}
steps:
- name: Wait for checks
uses: fountainhead/[email protected]
id: checks
with:
checkName: Generate code
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get changed generated files
id: changed
uses: tj-actions/changed-files@v44
with:
dir_names: true
dir_names_include_files: |
src/lib/seam/connect/routes/**
merge:
name: Merge #${{ github.event.number }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs: changes
if: needs.changes.outputs.has_changes == 'true'
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files_separator: ' '
dir_names: true
dir_names_include_files: |
src/lib/seam/connect/routes/**
- name: Approve pull request
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
# - name: Merge pull request
# run: gh pr merge --auto --merge "$PR_URL"
# env:
# PR_URL: ${{ github.event.pull_request.html_url }}
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
close:
name: Close #${{ github.event.number }}
runs-on: ubuntu-latest
timeout-minutes: 30
needs: changes
if: needs.changes.outputs.has_changes == 'false'
steps:
- name: Close pull request
# run: gh pr close "$PR_URL"
run: true
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
7 changes: 3 additions & 4 deletions generate-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,10 @@ const createRoutes = (): Route[] => {
)

if (unmatchedEndpointPaths.length > 0) {
// eslint-disable-next-line no-console
console.warn(
`The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n${unmatchedEndpointPaths.join(
throw new Error(
`The following endpoints will not be generated (add them to routePaths in generate-routes.ts):\n\n${unmatchedEndpointPaths.join(
'\n',
)}`,
)}\n`,
)
}

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,6 @@
"tsx": "^4.6.2",
"type-fest": "^4.3.1",
"typedoc": "^0.25.2",
"typescript": "^5.1.0"
"typescript": "~5.3.0"
}
}
Loading