Skip to content

Poll Invitations

Poll Invitations #2263

---
name: Poll Invitations
on:
schedule:
- cron: '*/15 * * * *'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: poll-invitations
cancel-in-progress: false
jobs:
poll-invitations:
name: Poll pending collaboration invitations
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: ⤵ Checkout Branch
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: 📦 Setup
uses: ./.github/actions/setup
# metadata/repos.yaml writes must land with the App token, not the user-scoped PAT
# — FRO_BOT_POLL_PAT stays reserved for reading/accepting invitations and starring.
- name: 🔑 Mint App token for metadata writes
id: metadata-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
app-id: ${{ secrets.APPLICATION_ID }}
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
repositories: ${{ github.event.repository.name }}
permission-contents: write
- name: 📬 Poll invitations
id: poll
env:
GITHUB_TOKEN: ${{ secrets.FRO_BOT_POLL_PAT }}
METADATA_WRITE_TOKEN: ${{ steps.metadata-token.outputs.token }}
run: node scripts/handle-invitation.ts
# Best-effort Discord presence: announce accepted public invitations to the
# gateway, which posts in Fronomenal as the Fro Bot user. Only public,
# non-redacted repos are in the list output (handle-invitation.ts gates that).
# Never fails the run — gateway-announce.ts exits 0 on any error.
- name: 📣 Announce invitations to gateway
if: steps.poll.outputs.public_invitations_accepted > 0
env:
EVENT_TYPE: invitation_accepted
INVITATIONS_ACCEPTED: ${{ steps.poll.outputs.public_invitations_accepted }}
INVITATIONS_REPOS: ${{ steps.poll.outputs.public_invitations_accepted_repos }}
GATEWAY_PRESENCE_URL: ${{ vars.GATEWAY_PRESENCE_URL }}
GATEWAY_WEBHOOK_SECRET: ${{ secrets.GATEWAY_WEBHOOK_SECRET }}
GATEWAY_ANNOUNCE_DISABLED: ${{ vars.GATEWAY_ANNOUNCE_DISABLED }}
run: |
EVENT_CONTEXT_JSON="$(jq -nc \
--argjson count "$INVITATIONS_ACCEPTED" \
--argjson repos "$INVITATIONS_REPOS" \
'{count: $count, repos: $repos}')"
export EVENT_CONTEXT_JSON
node scripts/gateway-announce.ts
# Bluesky posting is disabled pending re-evaluation of social channels.
# The script (scripts/bluesky-post.ts) is intentionally retained for future
# reactivation; only the step invocation here is gated off via `if: false`.
- name: 🦋 Post to Bluesky
if: false && steps.poll.outputs.public_invitations_accepted > 0
env:
BLUESKY_HANDLE: ${{ secrets.BLUESKY_HANDLE }}
BLUESKY_APP_PASSWORD: ${{ secrets.BLUESKY_APP_PASSWORD }}
INVITATIONS_ACCEPTED: ${{ steps.poll.outputs.public_invitations_accepted }}
run: |
node scripts/bluesky-post.ts \
"🌐 Just accepted ${INVITATIONS_ACCEPTED} collaboration invitation(s) on GitHub. The network grows ✨ #GitHub #OpenSource"