mirror of
https://github.com/barkeser2002/node-minecraft-protocol.git
synced 2026-09-25 05:10:10 +03:00
* start 1.21.6 * fix packettest * update * fix * Update ci.yml --------- Co-authored-by: Romain Beaumont <romain.rom1@gmail.com>
3.0 KiB
3.0 KiB
Cross-Repository Workflow Trigger Setup
This document explains how to set up cross-repository workflow triggering between the minecraft-data repository and this repository.
Overview
The workflow update-from-minecraft-data.yml can be triggered from the minecraft-data repository in two ways:
- Manual Workflow Dispatch - Triggered manually or programmatically
- Repository Dispatch - Triggered via webhook/API call
Setup in minecraft-data repository
Method 1: Workflow Dispatch (Recommended)
Add this step to a workflow in the minecraft-data repository:
- name: Trigger update in node-minecraft-protocol
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CROSS_REPO_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'extremeheat',
repo: 'node-minecraft-protocol',
workflow_id: 'update-from-minecraft-data.yml',
ref: 'master', // or the target branch
inputs: {
trigger_source: 'minecraft-data',
trigger_reason: 'data_update',
data_version: '${{ steps.get_version.outputs.version }}' // or your version variable
}
});
Method 2: Repository Dispatch
- name: Trigger update in node-minecraft-protocol
uses: actions/github-script@v7
with:
github-token: ${{ secrets.CROSS_REPO_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({
owner: 'extremeheat',
repo: 'node-minecraft-protocol',
event_type: 'minecraft-data-update',
client_payload: {
repository: 'minecraft-data',
reason: 'data_update',
version: '${{ steps.get_version.outputs.version }}'
}
});
Required Secrets
You need to create a Personal Access Token (PAT) with the following permissions:
reposcope (for private repositories)public_reposcope (for public repositories)actions:writepermission
Add this token as a secret named CROSS_REPO_TOKEN in the minecraft-data repository.
Token Setup Steps
- Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
- Generate a new token with appropriate permissions
- Add the token as
CROSS_REPO_TOKENsecret in minecraft-data repository settings
Customizing the Updator Script
The updator script (.github/helper/updator.js) can be customized to:
- Download and process minecraft-data updates
- Update protocol definitions
- Run tests to verify compatibility
- Create pull requests for review
- Send notifications
Testing
You can test the workflow manually by:
- Going to the Actions tab in this repository
- Selecting "Update from minecraft-data" workflow
- Clicking "Run workflow"
- Providing test inputs
Security Considerations
- Use repository secrets for sensitive tokens
- Limit token permissions to minimum required
- Consider using short-lived tokens or GitHub Apps for enhanced security
- Review and approve automatic commits/PRs if needed