Skip to content

Implement config management with hot-reload and schema validation (fixes #122) #8

Implement config management with hot-reload and schema validation (fixes #122)

Implement config management with hot-reload and schema validation (fixes #122) #8

Workflow file for this run

name: Auto-merge PRs
on:
pull_request:
types: [opened]
permissions:
pull-requests: write
contents: write
jobs:
enable-auto-merge:
runs-on: ubuntu-latest
steps:
- name: Enable auto-merge
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
try {
// Enable auto-merge with squash method
await github.graphql(`
mutation($pullRequestId: ID!, $mergeMethod: PullRequestMergeMethod!) {
enablePullRequestAutoMerge(input: {
pullRequestId: $pullRequestId,
mergeMethod: $mergeMethod
}) {
pullRequest {
autoMergeRequest {
enabledAt
}
}
}
}
`, {
pullRequestId: `PR_${context.repo.owner}_${context.repo.repo}_${prNumber}`,
mergeMethod: 'SQUASH'
});
console.log(`Auto-merge enabled for PR #${prNumber}`);
} catch (error) {
// Try alternative method using REST API
try {
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
merge_method: 'squash'
});
} catch (mergeError) {
console.log(`Auto-merge not available: ${error.message}`);
}
}