diff --git a/.github/workflows/pr-auto-label.yml b/.github/workflows/pr-auto-label.yml new file mode 100644 index 0000000..3b33b60 --- /dev/null +++ b/.github/workflows/pr-auto-label.yml @@ -0,0 +1,28 @@ +name: "Automatically mark PRs to sync" + +on: + pull_request: + types: + - opened + +jobs: + labeler: + if: github.event.pull_request.user.type != 'Bot' + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - name: Add "sync" label to PR + run: gh pr edit "$PR_URL" --add-label sync --repo "$PR_REPO" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_REPO: ${{ github.repository }} + + - name: Comment on PR to explain sync label + run: gh pr comment "$PR_URL" --body "This pull request has been marked to **automatically sync** to its base branch. You can **disable** this behavior by removing the `sync` label." --repo "$PR_REPO" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_REPO: ${{ github.repository }} \ No newline at end of file diff --git a/.github/workflows/pr-auto-merge.yml b/.github/workflows/pr-auto-merge.yml new file mode 100644 index 0000000..5be0926 --- /dev/null +++ b/.github/workflows/pr-auto-merge.yml @@ -0,0 +1,23 @@ +name: "Automatically enable auto-merge on PRs" + +on: + pull_request_target: + types: + - opened + - ready_for_review + branches: + - main + +jobs: + enable-automerge: + if: github.event.pull_request.draft == false + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - name: Enable auto-merge for the PR + run: gh pr merge "$PR_URL" --auto --squash + env: + GH_TOKEN: ${{ secrets.PR_AUTO_UPDATE_TOKEN }} + PR_URL: ${{ github.event.pull_request.html_url }} \ No newline at end of file diff --git a/.github/workflows/pr-auto-update.yml b/.github/workflows/pr-auto-update.yml new file mode 100644 index 0000000..28ac1c8 --- /dev/null +++ b/.github/workflows/pr-auto-update.yml @@ -0,0 +1,26 @@ +name: pr-auto-update +on: + push: {} + +jobs: + pr-auto-update: + name: Automatic PR Updater + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + steps: + - name: Generate Access Token + uses: actions/create-github-app-token@v2 + id: generate-token + with: + app-id: ${{ vars.PR_AUTO_UPDATE_CLIENT_ID }} + private-key: ${{ secrets.PR_AUTO_UPDATE_PRIVATE_KEY }} + + - uses: CSSUoB/pr-auto-updater@v2.3.1 + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + PR_FILTER: 'labelled' + PR_LABELS: 'sync' + MERGE_CONFLICT_ACTION: 'label' + MERGE_CONFLICT_LABEL: 'conflict' \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13f4ccf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM ruby:4.0.1 AS base + +RUN bundle config set frozen 'true' && \ + bundle config set path '/vendor/bundle' + +WORKDIR /usr/src/app + +COPY Gemfile Gemfile.lock ./ +RUN bundle install + +COPY . . + +FROM base AS build-step +RUN bundle exec jekyll build + +FROM scratch AS build +COPY --from=build-step /usr/src/app/_site / + +FROM base AS server +EXPOSE 4000 +CMD bundle exec jekyll serve --host 0.0.0.0 --port 4000 --destination /tmp/_site \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4454730 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +.PHONY: all build serve clean + +all: build + +build: clean + docker buildx build . --target build --output type=local,dest=./_site + +serve: + docker compose up --build + +clean: + rm -rf _site + +fmt: + npm run format:fix + +lint: + npm run lint:fix + +spellcheck: + npm run spellcheck:staged \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..25c3b68 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,9 @@ +services: + jekyll: + build: + context: . + target: server + volumes: + - "./:/usr/src/app" + ports: + - "4000:4000" \ No newline at end of file