Skip to content

Commit

Permalink
Fix Renovate Terraform workflow issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Aug 13, 2023
1 parent 729cdaa commit ad541ff
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/renovate-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ jobs:
context: ${{ steps.event.outputs.context }}
description: ${{ steps.event.outputs.description }}
pr_author: ${{ steps.pr.outputs.pr_author }}
pr_author_is_bot: ${{ steps.pr.outputs.pr_author_is_bot }}
pr_mergeable: ${{ steps.pr.outputs.pr_mergeable }}
pr_number: ${{ steps.pr.outputs.pr_number }}
pr_state: ${{ steps.pr.outputs.pr_state }}
sender: ${{ steps.event.outputs.sender.login }}
state: ${{ steps.event.outputs.state }}
verified: ${{ steps.event.outputs.verified }}
Expand Down Expand Up @@ -57,27 +55,29 @@ jobs:
echo "verified: ${{ github.event.commit.commit.verification.verified }}"
- name: Pull request details
if: >-
startsWith(steps.event.outputs.branch, 'renovate/') &&
steps.event.outputs.commit_author == vars.RENOVATE_USERNAME &&
steps.event.outputs.context == 'Terraform Cloud/ghalactic/repos' &&
steps.event.outputs.description == 'Terraform plan has no changes' &&
steps.event.outputs.sender == 'terraform-cloud[bot]' &&
steps.event.outputs.state == 'success' &&
steps.event.outputs.verified == 'true'
id: pr
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
run: |
export PR=$(gh pr list --repo "$GITHUB_REPOSITORY" --author '${{ vars.RENOVATE_USERNAME }}' --json author,mergeable,number,state --search '${{ steps.event.outputs.commit_sha }}')
export PR=$(gh pr list --repo "$GITHUB_REPOSITORY" --author '${{ vars.RENOVATE_USERNAME }}' --state OPEN --json author,mergeable,number --search '${{ steps.event.outputs.commit_sha }}')
echo "pr_author=$(echo $PR | jq -r '.[0].author.login')" >> $GITHUB_OUTPUT
echo "pr_author: $(echo $PR | jq -r '.[0].author.login')"
echo "pr_author_is_bot=$(echo $PR | jq -r '.[0].author.is_bot')" >> $GITHUB_OUTPUT
echo "pr_author_is_bot: $(echo $PR | jq -r '.[0].author.is_bot')"
echo "pr_mergeable=$(echo $PR | jq -r '.[0].mergeable')" >> $GITHUB_OUTPUT
echo "pr_mergeable: $(echo $PR | jq -r '.[0].mergeable')"
echo "pr_number=$(echo $PR | jq -r '.[0].number')" >> $GITHUB_OUTPUT
echo "pr_number: $(echo $PR | jq -r '.[0].number')"
echo "pr_state=$(echo $PR | jq -r '.[0].state')" >> $GITHUB_OUTPUT
echo "pr_state: $(echo $PR | jq -r '.[0].state')"
automerge:
name: Auto-merge
runs-on: ubuntu-latest
Expand All @@ -90,9 +90,7 @@ jobs:
needs.collect_details.outputs.context == 'Terraform Cloud/ghalactic/repos' &&
needs.collect_details.outputs.description == 'Terraform plan has no changes' &&
needs.collect_details.outputs.pr_author == vars.RENOVATE_USERNAME &&
needs.collect_details.outputs.pr_author_is_bot == 'false' &&
needs.collect_details.outputs.pr_mergeable == 'MERGEABLE' &&
needs.collect_details.outputs.pr_state == 'OPEN' &&
needs.collect_details.outputs.sender == 'terraform-cloud[bot]' &&
needs.collect_details.outputs.state == 'success' &&
needs.collect_details.outputs.verified == 'true'
Expand Down

0 comments on commit ad541ff

Please sign in to comment.