Skip to content

Commit

Permalink
Merge pull request #63 from tablelandnetwork/staging
Browse files Browse the repository at this point in the history
Ship 5a Season 6
  • Loading branch information
joewagner authored May 16, 2023
2 parents affa0ad + 77ba4b4 commit 605e4a1
Show file tree
Hide file tree
Showing 27 changed files with 737 additions and 737 deletions.
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
Expand Down
136 changes: 136 additions & 0 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: "Combine PRs"

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: "Branch prefix to find combinable PRs based on"
required: true
default: "dependabot"
mustBeGreen:
description: "Only combine PRs that are green (status is success)"
required: true
default: "true"
combineBranchName:
description: "Name of the branch to combine PRs into"
required: true
default: "combine-prs-branch"
ignoreLabel:
description: "Exclude PRs with this label"
required: true
default: "nocombine"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "combine-prs"
combine-prs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/github-script@v6
id: create-combined-pr
name: Create Combined PR
with:
github-token: ${{secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: context.repo.repo
});
let branchesAndPRStrings = [];
let baseBranch = null;
let baseBranchSHA = null;
for (const pull of pulls) {
const branch = pull['head']['ref'];
console.log('Pull for branch: ' + branch);
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched prefix: ' + branch);
let statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
const checkRuns = await github.request('GET /repos/{owner}/{repo}/commits/{ref}/check-runs', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch
});
for await (const cr of checkRuns.data.check_runs) {
console.log('Validating check conclusion: ' + cr.conclusion);
if(cr.conclusion != 'success') {
console.log('Discarding ' + branch + ' with check conclusion ' + cr.conclusion);
statusOK = false;
}
}
}
console.log('Checking labels: ' + branch);
const labels = pull['labels'];
for(const label of labels) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
console.log('Discarding ' + branch + ' with label ' + labelName);
statusOK = false;
}
}
if (statusOK) {
console.log('Adding branch to array: ' + branch);
const prString = '#' + pull['number'] + ' ' + pull['title'];
branchesAndPRStrings.push({ branch, prString });
baseBranch = pull['base']['ref'];
baseBranchSHA = pull['base']['sha'];
}
}
}
if (branchesAndPRStrings.length == 0) {
core.setFailed('No PRs/branches matched criteria');
return;
}
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}',
sha: baseBranchSHA
});
} catch (error) {
console.log(error);
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
return;
}
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
try {
await github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: '${{ github.event.inputs.combineBranchName }}',
head: branch,
});
console.log('Merged branch ' + branch);
combinedPRs.push(prString);
} catch (error) {
console.log('Failed to merge branch ' + branch);
mergeFailedPRs.push(prString);
}
}
console.log('Creating combined PR');
const combinedPRsString = combinedPRs.join('\n');
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString;
if(mergeFailedPRs.length > 0) {
const mergeFailedPRsString = mergeFailedPRs.join('\n');
body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString
}
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Combined PR',
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
body: body
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ on:
push:
branches:
- main

concurrency:
group: docs-${{github.ref}}
cancel-in-progress: true

jobs:
docs:
runs-on: ubuntu-latest

steps:
- name: Checkout 🛎️
uses: actions/[email protected]
Expand All @@ -22,15 +28,19 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node Environment
uses: actions/setup-node@v2
- name: Setup ⬢
uses: actions/setup-node@v2-beta
with:
node-version: 14
node-version: 18

- name: Install 🔧
run: npm install

- name: Build 🛠
run: npm run build

- name: Install and Build 🔧
- name: Docs 📓
run: |
npm install
npm run build:all
npm run docs:html
touch docs/.nojekyll
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/lint-and-test.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Review
on:
push:
branches:
- main
pull_request:

concurrency:
group: review-${{github.ref}}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]
with:
persist-credentials: false

- name: Cache 📦
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node Environment ⬢
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install 🔧
run: npm install

- name: Lint/Format 🙈
run: npm run prettier && npm run lint
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test
on:
push:
branches:
- main
pull_request:

concurrency:
group: test-${{github.ref}}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]
with:
persist-credentials: false

- name: Cache 📦
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node Environment ⬢
uses: actions/setup-node@v1
with:
node-version: 18

- name: Install 🔧
run: npm install

- name: Build 🛠
run: npm run build

- name: Test/Coverage 🧪
run: npm test
8 changes: 2 additions & 6 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"extensions": [
"ts"
],
"extensions": ["ts"],
"spec": "test/*.test.ts",
"file": [
"test/setup.ts"
],
"file": ["test/setup.ts"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
Expand Down
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
coverage
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"semi": true,
"trailingComma": "es5"
}
6 changes: 3 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "2.0.0",
"tasks": [
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "build",
Expand All @@ -24,4 +24,4 @@
"detail": "jest"
}
]
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @tableland/jeti (JavaScript Extension for Tableland and IPFS)
# @tableland/jeti (JavaScript Extension for Tableland Integrations)

[![Lint and test](https://github.com/tablelandnetwork/js-tableland/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/tablelandnetwork/js-tableland/actions/workflows/lint-and-test.yml)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/tablelandnetwork/js-tableland.svg)](./package.json)
Expand All @@ -11,7 +11,7 @@ This library is only compatible with version 3 of `@tableland/sdk`.

# Table of Contents

- [@tableland/jeti (JavaScript Extension for Tableland and IPFS)](#tablelandjeti-javascript-extension-for-tableland-and-ipfs)
- [@tableland/jeti (JavaScript Extension for Tableland Integrations)](#tablelandjeti-javascript-extension-for-tableland-integrations)
- [Table of Contents](#table-of-contents)
- [Background](#background)
- [Install](#install)
Expand Down Expand Up @@ -86,7 +86,7 @@ async function handleRequest(request: Request): Promise<Response> {
// 'row' now contains the actual content as an AsyncIterator of a UINT8Array

return new Response(JSON.stringify({ rows, columns }), {
headers: { "content-type": "application/json" }
headers: { "content-type": "application/json" },
});
}
```
Expand Down
Loading

0 comments on commit 605e4a1

Please sign in to comment.