Skip to content

Commit 96e6220

Browse files
authored
chore: new project syncing setup (#3136)
## Description Revamps how we track PRs and Issues to add onto repos. Mainly because this produced issues with forks but also did all the work attribution to me. The downside of this approach is that it runs on a schedule (set to every 6 hours but we can change). Also if GH api craps out on us we have to wait till the next trigger. ## Breaking Changes <!-- Optional, if there are any breaking changes document them, including how to migrate older code. --> ## Notes & open questions <!-- Any notes, remarks or open questions you have to make about the PR. --> ## Change checklist - [ ] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 43e9805 commit 96e6220

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/project_sync.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Add PRs and Issues to the Project Board
2+
3+
on:
4+
schedule:
5+
- cron: '0 * * * *'
6+
workflow_dispatch:
7+
8+
env:
9+
REPOS_LIST: "iroh tools n0.computer ops iroh.computer quic-rpc chuck abao bao-tree iroh-examples iroh.network tokio-rustls-acme iroh-ffi iroh-car iroh-io iroh-blake3 dumbpipe.dev dumbpipe sendme swarmie iroh-c-ffi willow-store quinn iroh-experiments willow-rs iroh-gossip iroh-doctor iroh-blobs iroh-docs iroh-s3 iroh-doctor-server iroh-willow iroh-metrics net-tools iroh-node-util workflows ips"
10+
11+
jobs:
12+
add-to-project:
13+
name: Add to project board
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/create-github-app-token@v1
17+
id: app-token
18+
with:
19+
app-id: ${{ secrets.N0_BOT_APP_ID }}
20+
private-key: ${{ secrets.PROJECT_BOARD_PKEY }}
21+
owner: n0-computer
22+
23+
- name: Update PRs
24+
env:
25+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
26+
run: |
27+
for REPO in $REPOS_LIST; do
28+
echo "Processing repository: $REPO"
29+
30+
gh pr list --repo n0-computer/$REPO --state open --json number,projectItems | jq -r '.[] | select(.projectItems | length == 0) | .number' > pr_list.txt
31+
while read -r PR_NUMBER; do
32+
echo "Processing PR #$PR_NUMBER"
33+
gh pr edit "$PR_NUMBER" --repo n0-computer/$REPO --add-project iroh
34+
done < pr_list.txt
35+
done
36+
37+
- name: Update ISSUEs
38+
env:
39+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
40+
run: |
41+
for REPO in $REPOS_LIST; do
42+
gh issue list --repo n0-computer/$REPO --state open --json number,projectItems | jq -r '.[] | select(.projectItems | length == 0) | .number' > issue_list.txt
43+
while read -r ISSUE_NUMBER; do
44+
echo "Processing Issue #$ISSUE_NUMBER"
45+
gh issue edit "$ISSUE_NUMBER" --repo n0-computer/$REPO --add-project iroh
46+
done < issue_list.txt
47+
done

0 commit comments

Comments
 (0)