From 24cf61eefa505cb4e7e4d61df508604474087cbd Mon Sep 17 00:00:00 2001 From: ndeta100 Date: Thu, 11 Jan 2024 22:12:32 +0200 Subject: [PATCH] create a workflow for auto merge prs and a Dockerfile --- .github/workflows/auto-merge.yaml | 30 ++++++++++++++++++++++++++++++ Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/auto-merge.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/auto-merge.yaml b/.github/workflows/auto-merge.yaml new file mode 100644 index 0000000..f407dea --- /dev/null +++ b/.github/workflows/auto-merge.yaml @@ -0,0 +1,30 @@ +name: Auto Merge PRs +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + test-and-merge: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '^1.18.1' + + - name: Test + run: go test ./... + + - name: Merge PR + if: github.event.pull_request.mergeable_state == 'clean' + uses: pascalgn/automerge-action@v0.14.3 + with: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + MERGE_LABELS: "auto-merge,approved" # Specify your labels here + MERGE_METHOD: "squash" # Choose merge method: merge, squash or rebase + MERGE_RETRIES: "3" + MERGE_RETRY_SLEEP: "10000" + MERGE_REMOVE_LABELS: "auto-merge,approved" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..986dc99 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM golang:1.20.3-alpine + +# Set the working dir +WORKDIR /app + +# Copy the go.mod and go.sum files to the working dir +COPY go.mod go.sum ./ + +# Download and install any requires Go dependencies +RUN go mod download + +# Copy the entire source to the working dir +COPY . . + +# Build the go application +RUN go build -o main . + +# Expose the port specified by the PORT env variiable +EXPOSE 3000 + +# Set the entry point of the container to the executable +CMD ["./main"] \ No newline at end of file