From 15e0d366b67c2b363972f8581c718577961a8775 Mon Sep 17 00:00:00 2001 From: Brooks Beverstock <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:34:04 -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 | 67 ++++++++++++++++++++++++++ 4 files changed, 85 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 9e95fd07..c67c9d8f 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 00000000..9e95fd07 --- /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 31b173c7..6a3a9296 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,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 metadata id: meta diff --git a/.github/workflows/build.yml.bak b/.github/workflows/build.yml.bak new file mode 100644 index 00000000..31b173c7 --- /dev/null +++ b/.github/workflows/build.yml.bak @@ -0,0 +1,67 @@ +name: Build and test code + +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: + + +jobs: + build: + name: Test + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: golangci-lint + uses: golangci/golangci-lint-action@v6 + with: + version: latest + args: "--timeout 5m" + - name: Build + run: go build -mod=readonly ./cmd/atlantis-drift-detection/main.go + - name: Verify + run: go mod verify + - name: Test + run: go test -v ./... + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + id: buildx + with: + install: true + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + tags: | + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + type=semver,pattern=v{{major}},enable=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} + images: | + ghcr.io/cresta/atlantis-drift-detection + - name: Build and push + uses: docker/build-push-action@v6 + with: + # Push only if tag + push: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file From 06b60c57afd446da6c977fe382a3d4f9b8d3f922 Mon Sep 17 00:00:00 2001 From: Brooks <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:51:45 -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 9e95fd07..00000000 --- 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 1467bf698dd5ca1e5bacb721254884ea92b84127 Mon Sep 17 00:00:00 2001 From: Brooks <603632+bmbeverst@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:51:59 -0500 Subject: [PATCH 3/3] Delete .github/workflows/build.yml.bak --- .github/workflows/build.yml.bak | 67 --------------------------------- 1 file changed, 67 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 31b173c7..00000000 --- a/.github/workflows/build.yml.bak +++ /dev/null @@ -1,67 +0,0 @@ -name: Build and test code - -on: - push: - tags: - - v* - branches: - - master - - main - pull_request: - - -jobs: - build: - name: Test - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Check out code - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - version: latest - args: "--timeout 5m" - - name: Build - run: go build -mod=readonly ./cmd/atlantis-drift-detection/main.go - - name: Verify - run: go mod verify - - name: Test - run: go test -v ./... - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - id: buildx - with: - install: true - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - tags: | - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - type=semver,pattern=v{{major}},enable=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} - images: | - ghcr.io/cresta/atlantis-drift-detection - - name: Build and push - uses: docker/build-push-action@v6 - with: - # Push only if tag - push: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} - platforms: linux/amd64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file