Skip to content
Merged
Changes from all commits
Commits
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
58 changes: 58 additions & 0 deletions .github/workflows/sync-sourcebot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Sync Sourcebot Zoekt Dependency

# This workflow needs base-repository secrets for the cross-repository dispatch.
# It never checks out or executes pull request code.
on:
pull_request_target:
types: [closed]

permissions:
contents: read

jobs:
dispatch:
if: >-
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == github.event.repository.default_branch
runs-on: ubuntu-latest
steps:
- name: Generate Sourcebot GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.SOURCEBOT_SYNC_APP_ID }}
private-key: ${{ secrets.SOURCEBOT_SYNC_APP_PRIVATE_KEY }}
owner: sourcebot-dev
repositories: sourcebot
permission-contents: write

- name: Request Sourcebot dependency update
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
ZOEKT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
ZOEKT_PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail

jq -n \
--arg zoekt_sha "$ZOEKT_SHA" \
--arg zoekt_pr_number "$ZOEKT_PR_NUMBER" \
'{
event_type: "zoekt-pr-merged",
client_payload: {
zoekt_sha: $zoekt_sha,
zoekt_pr_number: $zoekt_pr_number
}
}' \
| gh api \
--method POST \
--header "Accept: application/vnd.github+json" \
--header "X-GitHub-Api-Version: 2022-11-28" \
--input - \
repos/sourcebot-dev/sourcebot/dispatches

{
echo "## Sourcebot sync requested"
echo
echo "Dispatched Zoekt PR #$ZOEKT_PR_NUMBER at \`$ZOEKT_SHA\`."
} >> "$GITHUB_STEP_SUMMARY"
Loading