Skip to content

Commit

Permalink
do changes check
Browse files Browse the repository at this point in the history
  • Loading branch information
drsherluck committed Mar 2, 2023
1 parent 62a842a commit 626f94d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,32 @@ inputs:
github-token:
description: 'Github token of the bot used for the auto-approving'
required: true
terraform-directory:
description: 'Root directory for the terraform files'
required: true
runs:
using: 'composite'
steps:
- run: |
# todo. check that this is a pr and skip (or fail) other workflow events
pr_number=$(echo "$GIHUB_REF" | cut -d '/' -f3)
gh pr -R "${GIHUB_REPOSITORY}" view "${pr_number}" --json files --jq '.files.[].path' \
| grep -qo "^${TERRAFORM_DIR}" && echo "skip=false"|| echo "skip=false" >> $GITHUB_OUTPUT
shell: bash
id: check
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
TERRAFORM_DIR: ${{ inputs.terraform-directory }}
- uses: actions/download-artifact@v3
if: steps.check.outputs.skip == 'false' # don't fail
with:
name: terraform
path: summary
- id: summary
if: steps.check.outputs.skip == 'false' # don't fail
shell: bash
run: cat summary/terraform/*.summary | grep 'true' || echo "has_changes=false" >> $GITHUB_OUTPUT
- uses: hmarr/auto-approve-action@v3
if: steps.summary.outputs.has_changes == 'false'
if: steps.bheck.outputs.skip == 'false' && steps.summary.outputs.has_changes == 'false'
with:
github-token: ${{ inputs.github-token }}

0 comments on commit 626f94d

Please sign in to comment.