-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
75 changed files
with
1,866 additions
and
804 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,140 @@ | ||
#Taken from https://github.com/hrvey/combine-prs-workflow/blob/master/combine-prs.yml | ||
#https://www.hrvey.com/blog/combine-dependabot-prs | ||
|
||
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@v3 | ||
id: fetch-branch-names | ||
name: Fetch branch names | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}); | ||
branches = []; | ||
prs = []; | ||
base_branch = 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: ' + branch); | ||
statusOK = true; | ||
if(${{ github.event.inputs.mustBeGreen }}) { | ||
console.log('Checking green status: ' + branch); | ||
const statuses = await github.paginate('GET /repos/{owner}/{repo}/commits/{ref}/status', { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: branch | ||
}); | ||
if(statuses.length > 0) { | ||
const latest_status = statuses[0]['state']; | ||
console.log('Validating status: ' + latest_status); | ||
if(latest_status != 'success') { | ||
console.log('Discarding ' + branch + ' with status ' + latest_status); | ||
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); | ||
branches.push(branch); | ||
prs.push('#' + pull['number'] + ' ' + pull['title']); | ||
base_branch = pull['base']['ref']; | ||
} | ||
} | ||
} | ||
if (branches.length == 0) { | ||
core.setFailed('No PRs/branches matched criteria'); | ||
return; | ||
} | ||
core.setOutput('base-branch', base_branch); | ||
core.setOutput('prs-string', prs.join('\n')); | ||
combined = branches.join(' ') | ||
console.log('Combined: ' + combined); | ||
return combined | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2.3.3 | ||
with: | ||
fetch-depth: 0 | ||
# Creates a branch with other PR branches merged together | ||
- name: Created combined branch | ||
env: | ||
BASE_BRANCH: ${{ steps.fetch-branch-names.outputs.base-branch }} | ||
BRANCHES_TO_COMBINE: ${{ steps.fetch-branch-names.outputs.result }} | ||
COMBINE_BRANCH_NAME: ${{ github.event.inputs.combineBranchName }} | ||
run: | | ||
echo "${{steps.fetch-branch-names.outputs.result}}" | ||
sourcebranches="${BRANCHES_TO_COMBINE%\"}" | ||
sourcebranches="${sourcebranches#\"}" | ||
basebranch="${BASE_BRANCH%\"}" | ||
basebranch="${basebranch#\"}" | ||
git config pull.rebase false | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git branch $COMBINE_BRANCH_NAME $basebranch | ||
git checkout $COMBINE_BRANCH_NAME | ||
git pull origin $sourcebranches --no-edit | ||
git push origin $COMBINE_BRANCH_NAME | ||
# Creates a PR with the new combined branch | ||
- uses: actions/github-script@v3 | ||
name: Create Combined Pull Request | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const prString = `${{ steps.fetch-branch-names.outputs.prs-string }}`; | ||
const body = 'This PR was created by the Combine PRs action by combining the following PRs:\n' + prString; | ||
await github.pulls.create({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: 'Combined PR', | ||
head: '${{ github.event.inputs.combineBranchName }}', | ||
base: '${{ steps.fetch-branch-names.outputs.base-branch }}', | ||
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 |
---|---|---|
|
@@ -5,9 +5,6 @@ | |
|
||
/public/env.js | ||
|
||
# vscode | ||
.vscode | ||
|
||
# dependencies | ||
node_modules | ||
|
||
|
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,67 @@ | ||
{ | ||
// Place your tb-mobile-app workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and | ||
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope | ||
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is | ||
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | ||
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. | ||
// Placeholders with the same ids are connected. | ||
// Example: | ||
// "Print to console": { | ||
// "scope": "javascript,typescript", | ||
// "prefix": "log", | ||
// "body": [ | ||
// "console.log('$1');", | ||
// "$2" | ||
// ], | ||
// "description": "Log output to console" | ||
// } | ||
"Component Scafold": { | ||
"prefix": "component-scafold", | ||
"body": [ | ||
"import React from 'react';", | ||
"import { makeStyles } from '@material-ui/core/styles';", | ||
"import useStores from '../../Basics/UseStores';", | ||
"import {observer} from 'mobx-react';", | ||
"", | ||
"const useStyles = makeStyles({", | ||
" ", | ||
"})", | ||
"", | ||
"const CompName = () => {", | ||
"", | ||
" const classes = useStyles();", | ||
"", | ||
" return(<div>", | ||
"", | ||
" </div>)", | ||
"", | ||
"}", | ||
"", | ||
"export default CompName;" | ||
], | ||
"description": "Component Scafold" | ||
}, | ||
"Class Names": { | ||
"prefix": "className", | ||
"body": [ | ||
"className={classes.$1}" | ||
], | ||
"description": "Class Names" | ||
}, | ||
"Translation": { | ||
"prefix": "translate", | ||
"body": [ | ||
"import { useTranslation } from 'react-i18next';", | ||
"const { t } = useTranslation('translation');" | ||
], | ||
"description": "i18n helper" | ||
}, | ||
"Common hooks": { | ||
"prefix": "common-hooks", | ||
"body": [ | ||
"const { t } = useTranslation('translation');", | ||
"const classes = useStyles();" | ||
], | ||
"description": "Common hooks to use in a sub component" | ||
}, | ||
} |
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
Oops, something went wrong.