Skip to content

Project Synchronization #12

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
21bf653
Adding project sync and more configurability
kewisch Feb 19, 2025
466a667
Add GitHub actions
kewisch Feb 20, 2025
f436929
Use matrix strategy to run synchronizers in parallel
kewisch Feb 21, 2025
a997796
Catch when priority values is empty
kewisch Mar 10, 2025
ee30459
Filter out pull requests in projects
kewisch Mar 19, 2025
ee2dd24
Move retry logic into httpx Client
kewisch Mar 25, 2025
a1b7e48
Determine sprint by title instead
kewisch Mar 29, 2025
bec45ac
Use orgrepo directly in is_repo_allowed
kewisch Mar 29, 2025
e7caa22
Introduce repository sets
kewisch Mar 29, 2025
1fc86fe
Update repository config to use repository sets
kewisch Mar 29, 2025
c95fcc9
Add Todd to production config
kewisch Mar 29, 2025
95a29f6
Be more explicit when synchronizing sprints
kewisch Mar 31, 2025
7b2cc82
Include project key in sync message
kewisch Mar 31, 2025
2ccbefb
Synchronize label for github issues
kewisch Mar 31, 2025
12896e2
Allow loading user map from environment
kewisch Mar 31, 2025
2132b51
Repeat connection on connection error
kewisch Mar 31, 2025
f2276f7
Take into account private repositories with one attendee
kewisch Apr 3, 2025
fed0cf2
Add backlink to Notion in roadmap project
kewisch Apr 4, 2025
6275012
Use functools cache instead of custom label cache
kewisch Apr 4, 2025
b67b919
Ability to create new issues via GitHub id property
kewisch Apr 4, 2025
6ff09ef
Keep community assignees on the issue
kewisch May 19, 2025
6a29e9f
Catch more network errors
kewisch May 19, 2025
28d44c7
fix: Correctly set milestone status for canceled milestones
kewisch May 27, 2025
0ebd0dd
Catch even more network errors
kewisch Jun 4, 2025
a127393
Chunk getting issues
kewisch Jun 27, 2025
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
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: CI

on:
pull_request:


jobs:
lint:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Setup Rye
uses: eifinger/setup-rye@6dc1fff0a98becbcc0cf542a05ae144c9f32b100 # v4.2.8
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Rye Sync
run: rye sync

- name: Rye Lint
env:
VERBOSE: ${{ runner.debug && '-v' || '' }}
run:
rye lint ${VERBOSE}

- name: Rye Format
env:
VERBOSE: ${{ runner.debug && '-v' || '' }}
run:
rye fmt --check ${VERBOSE}
19 changes: 19 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Scheduler

on:
schedule:
- cron: '*/5 * * * *'

concurrency:
group: cron
cancel-in-progress: false


jobs:
synchronize:
if: ${{ github.repository_owner == 'thunderbird' }}
uses: ./.github/workflows/run.yml
secrets: inherit
with:
environment: production
92 changes: 92 additions & 0 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
name: Notion Sync

on:
workflow_call:
inputs:
environment:
type: string
required: true
projects:
type: string
required: false

workflow_dispatch:
inputs:
environment:
type: environment
projects:
type: string
description: Enter one or more projects to sync. Leave empty for all.
dry:
type: boolean
description: Do a dry run


jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
synchronizers: ${{ steps.generate.outputs.synchronizers }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@6dc1fff0a98becbcc0cf542a05ae144c9f32b100 # v4.2.8
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Rye Sync
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye sync

- name: Generate
id: generate
env:
ENVIRONMENT: ${{ inputs.environment }}
PROJECTS: ${{ inputs.projects }}
run: |
if [ -z "${PROJECTS}" ]
then
echo "synchronizers=$(rye run sync -l -c sync_settings.${ENVIRONMENT}.toml | jq -R . | jq -sc .)" | tee -a $GITHUB_OUTPUT
else
echo "synchronizers=$(echo ${PROJECTS} | jq -R . | jq -sc .)" | tee -a $GITHUB_OUTPUT
fi

run:
needs: setup-matrix
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
strategy:
fail-fast: false
matrix:
synchronizer: ${{ fromJson(needs.setup-matrix.outputs.synchronizers) }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Rye
id: setup-rye
uses: eifinger/setup-rye@6dc1fff0a98becbcc0cf542a05ae144c9f32b100 # v4.2.8
with:
enable-cache: true
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Rye Sync
if: steps.setup-rye.outputs.cache-hit != 'true'
run: rye sync

- name: Synchronize
env:
ENVIRONMENT: ${{ inputs.environment }}
PROJECT: ${{ matrix.synchronizer }}
VERBOSE: ${{ runner.debug && '-vv' || '' }}
DRY: ${{ inputs.dry && '-n' || '' }}
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
NOTION_SYNC_GITHUB_USERMAP: ${{ vars.NOTION_SYNC_GITHUB_USERMAP }}
run: |
rye run sync ${DRY} ${VERBOSE} -c sync_settings.${ENVIRONMENT}.toml ${PROJECT}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
sync_settings.toml
users*.toml
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
Loading