-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from tablelandnetwork/bcalza/merge
Merge wasm sql parser with go sql parser
- Loading branch information
Showing
36 changed files
with
11,631 additions
and
12 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
|
||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Desktop (please complete the following information):** | ||
|
||
- OS: [e.g. iOS] | ||
- Browser [e.g. chrome, safari] | ||
- Version [e.g. 22] | ||
|
||
**Smartphone (please complete the following information):** | ||
|
||
- Device: [e.g. iPhone6] | ||
- OS: [e.g. iOS8.1] | ||
- Browser [e.g. stock browser, safari] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: "" | ||
labels: "" | ||
assignees: "" | ||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. E.g. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "npm" | ||
directory: "/js" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
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 | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Publish | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_version: | ||
description: "Version of this release" | ||
required: true | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./js | ||
|
||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cache 📦 | ||
uses: actions/cache@v3 | ||
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 ⬢ | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Setup TinyGo | ||
uses: acifani/setup-tinygo@v1 | ||
with: | ||
tinygo-version: '0.27.0' | ||
|
||
- name: Version 👍 | ||
id: version-bump | ||
uses: jaywcjlove/[email protected] | ||
with: | ||
version: ${{ github.event.inputs.release_version }} | ||
|
||
- name: Install 🔧 | ||
run: npm install | ||
|
||
- name: Build 🛠 | ||
run: npm run build | ||
|
||
- name: Tag 🏷️ | ||
uses: actions/github-script@v6 | ||
id: create-tag | ||
with: | ||
github-token: ${{secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN}} | ||
script: | | ||
await github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ github.event.inputs.release_version }}', | ||
sha: context.sha | ||
}) | ||
- name: Conditional ✅ | ||
id: cond | ||
uses: haya14busa/action-cond@v1 | ||
with: | ||
cond: ${{ contains(github.event.inputs.release_version, '-') }} | ||
if_true: "next" | ||
if_false: "latest" | ||
|
||
- name: Publish 📦 | ||
id: publish | ||
uses: JS-DevTools/npm-publish@v2 | ||
with: | ||
token: ${{ secrets.NPM_AUTH_TOKEN }} | ||
tag: ${{ steps.cond.outputs.value }} | ||
access: public | ||
|
||
- name: Release 🚀 | ||
if: steps.publish.outputs.type != 'none' | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.publish.outputs.version }} | ||
generateReleaseNotes: true | ||
prerelease: ${{ contains(steps.publish.outputs.type, 'pre') }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.