Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
simenandre committed Apr 13, 2021
1 parent 468e5ef commit 8ee7ead
Show file tree
Hide file tree
Showing 13 changed files with 1,070 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
1 change: 1 addition & 0 deletions .github/demo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions .github/header.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pull Request
on:
pull_request:

jobs:
preview-changes:
name: Preview changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Install pulumi
uses: pulumi/[email protected]
- uses: pulumi/actions@v2
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
PULUMI_GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
with:
command: preview
refresh: true
stack-name: prod
comment-on-pr: true
github-token: ${{ secrets.BJERKBOT_GITHUB_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Push
on:
push:
branches:
- main

jobs:
apply-changes:
name: Apply changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- name: Install pulumi
uses: pulumi/[email protected]
- uses: pulumi/actions@v2
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BJERKBOT_GITHUB_TOKEN }}
PULUMI_GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
with:
command: up
refresh: true
stack-name: prod
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
3 changes: 3 additions & 0 deletions Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: bjerk-bot
runtime: nodejs
description: The Bjerk Bot
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
# bot
<div style="text-align: center">
<img src=".github/header.svg" width="200px">
</div>

# Bjerk Bot

This repository contains code that defines which repositories the [@bjerkbot][bjerkbot] has access to.

## Add `bjerk-bot` to your repository!

You'll probably want to install [Github CLI][github-cli]. That will help you to get the `inviteId` (e.g. `44182036`).

1. Run `gh api -XPUT repos/:owner/:repo/collaborators/bjerk-bot`
2. Copy the `"id"`.
3. Open a pull request where you add this inviteId. Remember to add the repository as a comment.

```typescript
export const repositories = [
44182036, // bjerkio/bot
];
```

<img width="600" src="https://raw.githubusercontent.com/bjerkio/bot/main/.github/demo.svg" />

Open a pull request with your invi


[bjerkbot]: https://github.com/bjerk-bot
10 changes: 10 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// import * as pulumi from '@pulumi/pulumi';
import * as github from '@pulumi/github';
import { repositories } from './repositories';

repositories.map(
({ repo, invitationId }) =>
new github.UserInvitationAccepter(repo, {
invitationId: String(invitationId),
}),
);
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "github-npm-token",
"devDependencies": {
"@types/node": "^10.0.0"
},
"dependencies": {
"@pulumi/github": "^3.4.0",
"@pulumi/pulumi": "^2.0.0"
}
}
3 changes: 3 additions & 0 deletions repositories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const repositories = [
{ repo: 'bjerkio/bot', invitationId: 44182036 },
];
18 changes: 18 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.ts"
]
}
Loading

0 comments on commit 8ee7ead

Please sign in to comment.