From cd47808e8af27a80789d97ddf72a5601c98418ad Mon Sep 17 00:00:00 2001 From: Brooks Beverstock <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:34:01 -0500 Subject: [PATCH 1/3] fix: Use the creator of the PR not the last user. --- .github/workflows/autoapprove.yaml | 2 +- .github/workflows/autoapprove.yaml.bak | 16 +++++++ .github/workflows/build.yml | 2 +- .github/workflows/build.yml.bak | 60 ++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/autoapprove.yaml.bak create mode 100644 .github/workflows/build.yml.bak diff --git a/.github/workflows/autoapprove.yaml b/.github/workflows/autoapprove.yaml index 9e95fd0..c67c9d8 100644 --- a/.github/workflows/autoapprove.yaml +++ b/.github/workflows/autoapprove.yaml @@ -8,7 +8,7 @@ jobs: name: Auto approve renovatebot PRs runs-on: ubuntu-latest # Only if made by renovatebot application - if: github.actor == 'self-hosted-renovatebot[bot]' + if: github.event.pull_request.user.login == 'self-hosted-renovatebot[bot]' steps: - name: Approve uses: cresta/action-auto-approve-pr@v1 diff --git a/.github/workflows/autoapprove.yaml.bak b/.github/workflows/autoapprove.yaml.bak new file mode 100644 index 0000000..9e95fd0 --- /dev/null +++ b/.github/workflows/autoapprove.yaml.bak @@ -0,0 +1,16 @@ +name: Auto approves renovatebot PRs +on: + pull_request: + types: + - opened +jobs: + approve: + name: Auto approve renovatebot PRs + runs-on: ubuntu-latest + # Only if made by renovatebot application + if: github.actor == 'self-hosted-renovatebot[bot]' + steps: + - name: Approve + uses: cresta/action-auto-approve-pr@v1 + with: + token: ${{ secrets.CRESTA_ROBOT_AUTO_APPROVE_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4314202..7cd891d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,7 @@ jobs: uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.actor }} + username: ${{ github.event.pull_request.user.login }} password: ${{ secrets.GITHUB_TOKEN }} - name: Docker meta # Gives us fun and usable tags for the docker image id: meta diff --git a/.github/workflows/build.yml.bak b/.github/workflows/build.yml.bak new file mode 100644 index 0000000..4314202 --- /dev/null +++ b/.github/workflows/build.yml.bak @@ -0,0 +1,60 @@ +name: Build and test code + +on: + push: + tags: + - v* + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + name: Build/release + runs-on: ubuntu-latest + steps: + - name: Check out code # Required for dockerfile content + uses: actions/checkout@v4 + - name: Set up Docker Buildx # Required for build cache + uses: docker/setup-buildx-action@v3 + - name: Install Go # Required for running 'go test' + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: golangci-lint # Required for linting + uses: golangci/golangci-lint-action@v6 + with: + version: latest + - name: Build # Verify the build works. -mod=readonly is required to validate the go.mod/go.sum files + run: go build -mod=readonly ./cmd/helm-autoupdate/main.go + - name: Verify # Check that the go.mod/go.sum files are hash-identical to the ones in the repo + run: go mod verify + - name: Test # Run the tests + run: go test -v ./... + - name: Login to GitHub Container Registry # Required for pushing to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta # Gives us fun and usable tags for the docker image + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/cresta/helm-autoupdate + tags: | + type=ref,event=branch + type=ref,event=pr + type=match,pattern=v(.*),group=1 + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push # Build/push docker image for use in this action + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.ref == 'refs/heads/main' || github.ref_type == 'tag' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From cc75273d5f45a5148dca856dcda66c428bad7c56 Mon Sep 17 00:00:00 2001 From: Brooks <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:52:12 -0500 Subject: [PATCH 2/3] Delete .github/workflows/autoapprove.yaml.bak --- .github/workflows/autoapprove.yaml.bak | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/autoapprove.yaml.bak diff --git a/.github/workflows/autoapprove.yaml.bak b/.github/workflows/autoapprove.yaml.bak deleted file mode 100644 index 9e95fd0..0000000 --- a/.github/workflows/autoapprove.yaml.bak +++ /dev/null @@ -1,16 +0,0 @@ -name: Auto approves renovatebot PRs -on: - pull_request: - types: - - opened -jobs: - approve: - name: Auto approve renovatebot PRs - runs-on: ubuntu-latest - # Only if made by renovatebot application - if: github.actor == 'self-hosted-renovatebot[bot]' - steps: - - name: Approve - uses: cresta/action-auto-approve-pr@v1 - with: - token: ${{ secrets.CRESTA_ROBOT_AUTO_APPROVE_TOKEN }} \ No newline at end of file From a995284ba03c28559fbad334477691b6651b1ba2 Mon Sep 17 00:00:00 2001 From: Brooks <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:52:22 -0500 Subject: [PATCH 3/3] Delete .github/workflows/build.yml.bak --- .github/workflows/build.yml.bak | 60 --------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 .github/workflows/build.yml.bak diff --git a/.github/workflows/build.yml.bak b/.github/workflows/build.yml.bak deleted file mode 100644 index 4314202..0000000 --- a/.github/workflows/build.yml.bak +++ /dev/null @@ -1,60 +0,0 @@ -name: Build and test code - -on: - push: - tags: - - v* - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - name: Build/release - runs-on: ubuntu-latest - steps: - - name: Check out code # Required for dockerfile content - uses: actions/checkout@v4 - - name: Set up Docker Buildx # Required for build cache - uses: docker/setup-buildx-action@v3 - - name: Install Go # Required for running 'go test' - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - - name: golangci-lint # Required for linting - uses: golangci/golangci-lint-action@v6 - with: - version: latest - - name: Build # Verify the build works. -mod=readonly is required to validate the go.mod/go.sum files - run: go build -mod=readonly ./cmd/helm-autoupdate/main.go - - name: Verify # Check that the go.mod/go.sum files are hash-identical to the ones in the repo - run: go mod verify - - name: Test # Run the tests - run: go test -v ./... - - name: Login to GitHub Container Registry # Required for pushing to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Docker meta # Gives us fun and usable tags for the docker image - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/cresta/helm-autoupdate - tags: | - type=ref,event=branch - type=ref,event=pr - type=match,pattern=v(.*),group=1 - type=raw,value=latest,enable={{is_default_branch}} - - name: Build and push # Build/push docker image for use in this action - uses: docker/build-push-action@v6 - with: - context: . - push: ${{ github.ref == 'refs/heads/main' || github.ref_type == 'tag' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max