Skip to content

Commit

Permalink
Issue 894 add docker configuration (#898)
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderleek authored Sep 10, 2024
1 parent 1d641a6 commit 053fa15
Show file tree
Hide file tree
Showing 23 changed files with 142,494 additions and 168,227 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# The ID of your GitHub App
APP_ID=

# Go to https://smee.io/new set this to the URL that you are redirected to.
WEBHOOK_PROXY_URL=
WEBHOOK_SECRET=development

# Use `trace` to get verbose logging or `info` to show less
LOG_LEVEL=debug

# Go to https://smee.io/new set this to the URL that you are redirected to.
WEBHOOK_PROXY_URL=
19 changes: 13 additions & 6 deletions .github/workflows/app-stats.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
name: App Stats

on:
schedule:
- cron: '0 6 * * *'
- cron: '0 6 0 * *'

jobs:
log:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gr2m/[email protected]
- name: 'Checkout sources'
uses: actions/checkout@v4

- name: 'Collect stats'
uses: gr2m/[email protected]
id: stats
with:
id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}
- run: "echo '{\"installations\": ${{ steps.stats.outputs.installations }}, \"repositories\": ${{ steps.stats.outputs.repositories }}, \"suspended\": ${{ steps.stats.outputs.suspended_installations }}, \"popular\": ${{ steps.stats.outputs.popular_repositories }} }' > public/stats.json"
- name: Commit Action Installation Statistics

- name: 'Commit Action Installation Statistics'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add public/stats.json
git commit -m "Build by GitHub Actions" || true
if: job.status == 'success'
- name: Update repo

- name: 'Update repo'
run: git pull --no-rebase
- name: Push changes

- name: 'Push changes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
54 changes: 49 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,73 @@
name: 'main'
concurrency: main_environment

on:
push:
branches: main
branches:
- main
pull_request:
branches: main
branches:
- main

jobs:
tests:
cicd:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: 'Checkout sources'
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 'Setup NodeJS'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: 'Install dependencies'
run: yarn install

- name: 'Build distribution'
run: yarn action:dist

- name: 'Run unit-tests'
run: yarn test

- name: 'Run code coverage'
run: yarn run coverage

- name: 'Upload code coverage report'
run: bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_SECRET_TOKEN }}

- name: 'Build server dist'
run: yarn server:dist

- name: 'Build docker image'
run: docker build -t cib .

- name: 'Configure AWS credentials'
if: ${{ github.actor != 'dependabot[bot]' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}

- name: 'Login to Amazon ECR'
if: ${{ github.actor != 'dependabot[bot]' }}
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'

- name: 'Tag image for PR and push to ECR'
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
run: |
docker tag cib ${{ secrets.AWS_ECR_ENDPOINT }}:pr-${GITHUB_SHA::8}
docker push ${{ secrets.AWS_ECR_ENDPOINT }}:pr-${GITHUB_SHA::8}
- name: 'Tag image for main and push to ECR'
if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
run: |
docker tag cib ${{ secrets.AWS_ECR_ENDPOINT }}:main-${GITHUB_SHA::8}
docker tag cib ${{ secrets.AWS_ECR_ENDPOINT }}:main-latest
docker push ${{ secrets.AWS_ECR_ENDPOINT }}:main-${GITHUB_SHA::8}
docker push ${{ secrets.AWS_ECR_ENDPOINT }}:main-latest
22 changes: 16 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
name: 'release'
name: release

on: [workflow_dispatch]

jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
steps:
- name: 'Checkout sources'
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 'Setup NodeJS'
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: 'Install dependencies'
run: yarn install

- name: 'Run unit-tests'
run: yarn test
- name: 'Build distribution'

- name: 'Build GitHub Actions distribution'
run: yarn action:dist

- name: 'Semantic Release'
id: semantic
uses: cycjimmy/semantic-release-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: 'GitHub release'
if: steps.semantic.outputs.new_release_published == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.semantic.outputs.new_release_version }}
- name: 'Commit GitHub Action distribution'

- name: 'Commit GitHub Actions distribution'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add dist/index.js
git add action-dist/index.js
git commit -m "Build by GitHub Actions" || true
if: job.status == 'success'

- name: 'Push changes'
uses: ad-m/github-push-action@master
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'Close stale issues and PRs'
name: stale

on:
schedule:
- cron: '30 1 * * *'
Expand All @@ -7,7 +8,8 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
- name: 'Close stale issues and PRs'
uses: actions/stale@v9
with:
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
days-before-stale: 30
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ node_modules/
.private-key.pem
.private-key.staging.pem
coverage/
dist/static/
dist/views/
server-dist/
src/version.ts
.vercel/
.next/
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:20-alpine
RUN mkdir /app
COPY server-dist /app/server-dist
WORKDIR /app
RUN npm install pm2 -g
CMD ["pm2-runtime", "./server-dist/index.js"]
80 changes: 47 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
# Create Issue Branch

<div align="center">

![Logo](public/logo.png)

</div>

<div align="center">

*Boost your GitHub workflow 🚀*

</div>

<div align="center">

[![Maintainability](https://api.codeclimate.com/v1/badges/aaa03e6c10ce1ae9941f/maintainability)](https://codeclimate.com/github/robvanderleek/create-issue-branch/maintainability)
[![Build Status](https://github.com/robvanderleek/create-issue-branch/workflows/main/badge.svg)](https://github.com/robvanderleek/create-issue-branch/actions)
[![codecov](https://codecov.io/gh/robvanderleek/create-issue-branch/branch/main/graph/badge.svg?token=WBKIPs2WEc)](https://codecov.io/gh/robvanderleek/create-issue-branch)
[![Dependabot](https://badgen.net/badge/Dependabot/enabled/green?icon=dependabot)](https://dependabot.com/)
[![Sentry](https://img.shields.io/badge/sentry-enabled-green)](https://sentry.io)
![Vercel](https://vercelbadge.vercel.app/api/robvanderleek/create-issue-branch)

A GitHub App/Action that automates the creation of issue branches (either
automatically, or after assigning an issue, or after commenting on an issue
with a ChatOps command: `/create-issue-branch` or `/cib`).
</div>

Built in response to this feature request issue:
https://github.com/isaacs/github/issues/1125 (that issue is now closed and the
discussion [continuous
here](https://github.com/github/feedback/discussions/3441) and
[here](https://github.com/github/feedback/discussions/12290))
A GitHub App/Action that boosts your GitHub workflow by automating the creation
of issue branches (and many more things!)

> [!TIP]
> UPDATE 2/2/2022**: GitHub added a "Create a branch" button [to the web
> UI](https://github.blog/changelog/2022-03-02-create-a-branch-for-an-issue/)
>
> This App/Action offers some unique features not available in the new GitHub
> web UI button, such as:
>
> - [Configure branch name
> format](https://github.com/robvanderleek/create-issue-branch#branch-names)
> - [Configure default source
> branch](https://github.com/robvanderleek/create-issue-branch#default-source-branch)
> - [Configure source branch based on
> label](https://github.com/robvanderleek/create-issue-branch#source-branch-based-on-issue-label)
> - [Automatically open a (draft) Pull
> Request](https://github.com/robvanderleek/create-issue-branch#automatically-open-a-pull-request)
> - [Copy over attributes (such as labels and milestones) from the issue to the
> (draft)
> PR](https://github.com/robvanderleek/create-issue-branch#copy-attributes-from-issue)
> - [Configure PR target branch based on issue
> label](https://github.com/robvanderleek/create-issue-branch#pull-request-target-branch-based-on-issue-label)
> - [Feature requests are always
> welcome!](https://github.com/robvanderleek/create-issue-branch#feedback-suggestions-and-bug-reports)
>
> Perhaps the new GitHub button will be sufficient for your development
> workflow, if not give this App/Action a try.
Unique features offered by this app that are not available on GitHub:

- [Configure branch name
format](https://github.com/robvanderleek/create-issue-branch#branch-names)
- [Configure default source
branch](https://github.com/robvanderleek/create-issue-branch#default-source-branch)
- [Configure source branch based on
label](https://github.com/robvanderleek/create-issue-branch#source-branch-based-on-issue-label)
- [Automatically open a (draft) Pull
Request](https://github.com/robvanderleek/create-issue-branch#automatically-open-a-pull-request)
- [Copy over attributes (such as labels and milestones) from the issue to the
(draft)
PR](https://github.com/robvanderleek/create-issue-branch#copy-attributes-from-issue)
- [Configure PR target branch based on issue
label](https://github.com/robvanderleek/create-issue-branch#pull-request-target-branch-based-on-issue-label)
- [Feature requests are always
welcome!](https://github.com/robvanderleek/create-issue-branch#feedback-suggestions-and-bug-reports)

# Table of Contents

* [Installation](#installation)
* [Usage](#usage)
Expand Down Expand Up @@ -811,6 +812,19 @@ https://github.com/robvanderleek/create-issue-branch/issues
If you like this Action/App, please star :star: it.
## Project history
Create Issue Branch was Built in response to this feature request issue:
https://github.com/isaacs/github/issues/1125 (that issue is now closed and the
discussion [continuous
here](https://github.com/github/feedback/discussions/3441) and
[here](https://github.com/github/feedback/discussions/12290))
Early 2022 GitHub added a "Create a branch" button [to the web
UI](https://github.blog/changelog/2022-03-02-create-a-branch-for-an-issue/)
Perhaps the new GitHub button will be sufficient for your development workflow,
if not give this App/Action a try.
## Star history
[![Star History Chart](https://api.star-history.com/svg?repos=robvanderleek/create-issue-branch&type=Date)](https://star-history.com/#robvanderleek/create-issue-branch&Date)
Expand Down
Loading

0 comments on commit 053fa15

Please sign in to comment.