diff --git a/.github/workflows/conv-commits.yml b/.github/workflows/conv-commits.yml new file mode 100644 index 0000000..4fe9164 --- /dev/null +++ b/.github/workflows/conv-commits.yml @@ -0,0 +1,48 @@ +name: conventional-commits + +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize + +permissions: + contents: read + id-token: write + packages: read + pull-requests: write + statuses: write + +jobs: + pr-title: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 + id: lint_pr_title + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + wip: true + - uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 + # Even if the lint_pr_title step fails, we should populate error message. + if: always() && (steps.lint_pr_title.outputs.error_message != null) + with: + header: pr-title-lint + message: | + 👋🏼 Thank you for opening this pull request! + + This repo requires all pull request titles to follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. + + ``` + ${{ steps.lint_pr_title.outputs.error_message }} + ``` + + # Delete the comment when the issue has been resolved + - if: ${{ steps.lint_pr_title.outputs.error_message == null }} + uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 + with: + header: pr-title-lint + delete: true diff --git a/.github/workflows/dependabot-auto.yml b/.github/workflows/dependabot-auto.yml new file mode 100644 index 0000000..9b0d211 --- /dev/null +++ b/.github/workflows/dependabot-auto.yml @@ -0,0 +1,29 @@ +name: dependabot +on: pull_request + +permissions: + contents: write + pull-requests: write + +jobs: + auto-approve: + runs-on: ubuntu-latest + if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'sethrylan/bayesian' + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@d7267f607e9d3fb96fc2fbe83e0af444713e90b7 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Enable auto-merge for Dependabot PRs + if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch' + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Approve a PR + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GH_TOKEN: ${{secrets.GITHUB_TOKEN}} + diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..49d953c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: deploy + +on: + push: + branches: ['main'] + workflow_dispatch: + +# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: 'pages' + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: package.json + cache: 'npm' + - run: npm ci + - run: npm run build + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + # Upload dist folder + path: './dist' + - id: deployment + uses: actions/deploy-pages@v4