upsidr / merge-gatekeeper

Get better merge control
MIT License
92 stars 15 forks source link

Add image name as input #77

Closed jarredhawkins closed 3 months ago

jarredhawkins commented 3 months ago

After the rate limit changes introduced by docker on Github actions, we're getting rate limited since the action pulls a fresh image from the docker hub on each run.

Allow changing the image name via config, which allows us to self-host/proxy the base Golang image.

Fixes #69

jarredhawkins commented 3 months ago

~Eh might have gotten ahead of myself here, not sure build-args are supported for the default docker runner~

~This is true, but can inject with syntax: docker://alpine:3.8~

Seems like you can't use inputs in the image context.

jarredhawkins commented 3 months ago

After battling a few different approaches here, I ended up building and pushing my own modified dockerfile to ghcr.io with the ENTRYPOINT line removed. (Make sure you give whatever repo you're working in read access to this inside of the settings for the artifact -- this doesn't happen inside of the action config itself)

From there, modified a github action:

jobs:
  merge-gatekeeper:
    container:
      image: ghcr.io/your-path-here/merge-gatekeeper:0.0.1
      credentials:
        username: ${{ github.actor }}
        password: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - name: Run Merge Gatekeeper
        run: |
          /go/bin/merge-gatekeeper validate \
            --token=${{ secrets.GITHUB_TOKEN }} \
            --ref=${{ github.event.pull_request.head.sha }} \
            --interval=60 \
            --timeout=2100 \
            --ignored="ignore job input here"