Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions .github/workflows/app-stats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,11 @@ jobs:
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'
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'
- run: "echo installations: '${{ steps.stats.outputs.installations }}'"

- name: 'Update repo'
run: git pull --no-rebase
- run: "echo repositories: '${{ steps.stats.outputs.repositories }}'"

- name: 'Push changes'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
if: job.status == 'success'
- run: "echo suspended: '${{ steps.stats.outputs.suspended_installations }}'"

- run: "echo most popular repositories: '${{ steps.stats.outputs.popular_repositories }}'"
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ jobs:
- name: 'Upload code coverage report'
run: bash <(curl -s https://codecov.io/bash) -t ${{secrets.CODECOV_SECRET_TOKEN }}

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

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

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

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

- name: 'Configure AWS credentials'
Expand Down
33 changes: 9 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
release:
name: Semantic Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Checkout sources'
uses: actions/checkout@v4
Expand All @@ -24,30 +26,13 @@ jobs:
- name: 'Build GitHub Actions distribution'
run: yarn action:dist

- name: 'Commit GitHub Actions distribution'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Build by GitHub Actions
file_pattern: action-dist/index.js

- 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 Actions distribution'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
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:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
force: true
if: job.status == 'success'
run: npx semantic-release
5 changes: 5 additions & 0 deletions Dockerfile-action
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM node:20-alpine
RUN mkdir /app
COPY action-dist /app/action-dist
WORKDIR /app
CMD ["node", "./action-dist/index.js"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
[![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)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)


</div>

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/npm",
"@semantic-release/github",
{
"npmPublish": false
"publish": true
}
],
[
Expand Down
1 change: 0 additions & 1 deletion public/stats.json

This file was deleted.

8 changes: 0 additions & 8 deletions src/probot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default (app: Probot, {getRouter}: ApplicationFunctionOptions) => {
const buildDate = gitDate.toISOString().substring(0, 10);
app.log.info(`Create Issue Branch, version: ${version}, revison: ${gitSha.substring(0, 8)}, built on: ${buildDate}`);
if (getRouter) {
addStatsRoute(getRouter);
addPlansRoute(app, getRouter);
} else if (!isRunningInGitHubActions()) {
app.log.info('Custom routes not available!')
Expand Down Expand Up @@ -109,13 +108,6 @@ async function insertEventIntoDatabase(app: Probot, ctx: any) {
}
}

function addStatsRoute(getRouter: (path?: string) => express.Router) {
const router = getRouter('/probot')
router.get('/stats', (req, res) => {
res.redirect('https://raw.githubusercontent.com/robvanderleek/create-issue-branch/main/static/stats.json')
})
}

async function addPlansRoute(app: Probot, getRouter: (path?: string) => express.Router) {
const router = getRouter('/probot')
router.get('/plans', async (_, res) => {
Expand Down