Skip to content

Commit

Permalink
chore: new project syncing setup (#3136)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
Arqu authored Jan 22, 2025
1 parent 43e9805 commit 96e6220
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/project_sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Add PRs and Issues to the Project Board

on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:

env:
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"

jobs:
add-to-project:
name: Add to project board
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.N0_BOT_APP_ID }}
private-key: ${{ secrets.PROJECT_BOARD_PKEY }}
owner: n0-computer

- name: Update PRs
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
for REPO in $REPOS_LIST; do
echo "Processing repository: $REPO"
gh pr list --repo n0-computer/$REPO --state open --json number,projectItems | jq -r '.[] | select(.projectItems | length == 0) | .number' > pr_list.txt
while read -r PR_NUMBER; do
echo "Processing PR #$PR_NUMBER"
gh pr edit "$PR_NUMBER" --repo n0-computer/$REPO --add-project iroh
done < pr_list.txt
done
- name: Update ISSUEs
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
for REPO in $REPOS_LIST; do
gh issue list --repo n0-computer/$REPO --state open --json number,projectItems | jq -r '.[] | select(.projectItems | length == 0) | .number' > issue_list.txt
while read -r ISSUE_NUMBER; do
echo "Processing Issue #$ISSUE_NUMBER"
gh issue edit "$ISSUE_NUMBER" --repo n0-computer/$REPO --add-project iroh
done < issue_list.txt
done

0 comments on commit 96e6220

Please sign in to comment.