summaryrefslogtreecommitdiff
path: root/ci/github-script/run
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 19:47:58 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-04 19:47:58 +0300
commit8d0d919fbf43230148da7533519ed0ffdfaa4197 (patch)
tree27e352d6ca09910e577ec27a10659814e88b15b9 /ci/github-script/run
parentfce202465d4fede9e19d4d057eebbaa702291652 (diff)
downloadProject-Tick-8d0d919fbf43230148da7533519ed0ffdfaa4197.tar.gz
Project-Tick-8d0d919fbf43230148da7533519ed0ffdfaa4197.zip
NOISSUE add GitHub Actions scripts for PR preparation and review management
- Introduced `prepare.js` to validate PR mergeability and branch targeting. - Added `reviews.js` for automated review dismissal and posting. - Created `run` script to execute actions with GitHub context. - Implemented rate limiting in `withRateLimit.js` to manage API requests. - Added `supportedBranches.js` for branch classification logic. - Created `update-pinned.sh` for updating pinned dependencies. - Added `pinned.json` to manage pinned Nix dependencies. - Updated `libnbtplusplus` version from 2.3 to 3.0 and adjusted README accordingly. Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'ci/github-script/run')
-rwxr-xr-xci/github-script/run65
1 files changed, 65 insertions, 0 deletions
diff --git a/ci/github-script/run b/ci/github-script/run
new file mode 100755
index 0000000000..b523cc2dbc
--- /dev/null
+++ b/ci/github-script/run
@@ -0,0 +1,65 @@
+#!/usr/bin/env -S node --import ./run
+import { execSync } from 'node:child_process'
+import { closeSync, openSync } from 'node:fs'
+import { program } from 'commander'
+import * as core from '@actions/core'
+import { getOctokit } from '@actions/github'
+
+async function run(action, owner, repo, pull_number, options = {}) {
+ const token = execSync('gh auth token', { encoding: 'utf-8' }).trim()
+
+ const github = getOctokit(token)
+
+ const payload = !pull_number
+ ? {}
+ : {
+ pull_request: (
+ await github.rest.pulls.get({
+ owner,
+ repo,
+ pull_number,
+ })
+ ).data,
+ }
+
+ process.env['INPUT_GITHUB-TOKEN'] = token
+
+ closeSync(openSync('step-summary.md', 'w'))
+ process.env.GITHUB_STEP_SUMMARY = 'step-summary.md'
+
+ await action({
+ github,
+ context: {
+ payload,
+ repo: { owner, repo },
+ },
+ core,
+ dry: true,
+ ...options,
+ })
+}
+
+program
+ .command('prepare')
+ .description('Validate PR mergeability and branch targeting.')
+ .argument('<owner>', 'Repository owner (e.g. YongDo-Hyun)')
+ .argument('<repo>', 'Repository name (e.g. Project-Tick)')
+ .argument('<pr>', 'Pull Request number')
+ .option('--no-dry', 'Make actual modifications')
+ .action(async (owner, repo, pr, options) => {
+ const prepare = (await import('./prepare.js')).default
+ await run(prepare, owner, repo, pr, options)
+ })
+
+program
+ .command('lint-commits')
+ .description('Lint commit messages for Conventional Commits compliance.')
+ .argument('<owner>', 'Repository owner (e.g. YongDo-Hyun)')
+ .argument('<repo>', 'Repository name (e.g. Project-Tick)')
+ .argument('<pr>', 'Pull Request number')
+ .action(async (owner, repo, pr) => {
+ const lint = (await import('./lint-commits.js')).default
+ await run(lint, owner, repo, pr)
+ })
+
+program.parse()