Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
79a9defa
Unverified
Commit
79a9defa
authored
1 year ago
by
ikasoba
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
完成 (#12980)
parent
fc4c8682
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.github/workflows/check-misskey-js-autogen.yml
+127
-0
127 additions, 0 deletions
.github/workflows/check-misskey-js-autogen.yml
with
127 additions
and
0 deletions
.github/workflows/check-misskey-js-autogen.yml
0 → 100644
+
127
−
0
View file @
79a9defa
name
:
Check Misskey JS autogen
on
:
pull_request
:
branches
:
-
master
-
develop
paths
:
-
packages/backend/**
jobs
:
check-misskey-js-autogen
:
runs-on
:
ubuntu-latest
permissions
:
pull-requests
:
write
env
:
api_json_names
:
"
api-base.json
api-head.json"
steps
:
-
name
:
checkout
uses
:
actions/checkout@v4
with
:
submodules
:
true
-
name
:
setup pnpm
uses
:
pnpm/action-setup@v2
with
:
version
:
8
-
name
:
setup node
id
:
setup-node
uses
:
actions/setup-node@v4
with
:
node-version-file
:
'
.node-version'
cache
:
pnpm
-
name
:
install dependencies
run
:
pnpm i --frozen-lockfile
-
name
:
wait get-api-diff
uses
:
lewagon/wait-on-check-action@v1.3.3
with
:
ref
:
${{ github.event.pull_request.head.sha }}
check-regexp
:
get-from-misskey .+
repo-token
:
${{ secrets.GITHUB_TOKEN }}
wait-interval
:
30
-
name
:
Download artifact
uses
:
actions/github-script@v7
with
:
script
:
|
const fs = require('fs');
const workflows = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
head_sha: `${{ github.event.pull_request.head.sha }}`
}).then(x => x.data.workflow_runs);
console.log(workflows.map(x => ({name: x.name, title: x.display_title})));
const run_id = workflows.find(x => x.name.includes("Get api.json from Misskey")).id;
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run_id,
});
let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact"
});
await Promise.all(matchArtifacts.map(async (artifact) => {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data));
}));
-
name
:
unzip artifacts
run
:
|-
find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d . ';'
ls -la
-
name
:
build autogen
run
:
|-
for name in $(echo $api_json_names)
do
checksum=$(mktemp)
mv $name packages/misskey-js/generator/api.json
cd packages/misskey-js/generator
pnpm run generate
find built -type f -exec sh -c 'echo $(sed -E "s/^\s+\*\s+generatedAt:.+$//" {} | sha256sum | cut -d" " -f 1) {}' \; > $checksum
cd ../../..
cp $checksum ${name}_checksum
done
-
name
:
check update for type definitions
run
:
diff $(echo -n ${api_json_names} | awk -v RS=" " '{ printf "%s_checksum ", $0 }')
-
name
:
send message
if
:
failure()
uses
:
thollander/actions-comment-pull-request@v2
with
:
comment_tag
:
check-misskey-js-autogen
message
:
|-
Thank you for sending us a great Pull Request! 👍
Please regenerate misskey-js type definitions! 🙏
example:
```sh
pnpm run build-misskey-js-with-types
```
-
name
:
send message
if
:
success()
uses
:
thollander/actions-comment-pull-request@v2
with
:
comment_tag
:
check-misskey-js-autogen
mode
:
delete
message
:
"
Thank
you!"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment