Skip to content

Commit

Permalink
Make bulid-harness the authority on context.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru committed Dec 10, 2020
1 parent 4812b12 commit 51ce3b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions modules/github/Makefile.init
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ $(GITHUB_TERRAFORM_TEMPLATES): $(addprefix $(BUILD_HARNESS_PATH)/templates/terra
cp $(BUILD_HARNESS_PATH)/templates/terraform/$@ $@
git ls-files --error-unmatch $@ 2>/dev/null || git add $@

context:
github/init/context.tf:
curl -o context.tf -fsSL https://raw.githubusercontent.com/cloudposse/terraform-null-label/master/exports/context.tf
git ls-files --error-unmatch context.tf 2>/dev/null || git add context.tf
@if [[ -d examples/complete ]]; then \
cp -p context.tf examples/complete/context.tf ; \
fi

.PHONY: $(GITHUB_TEMPLATES) $(GITHUB_TERRAFORM_TEMPLATES) context
.PHONY: $(GITHUB_TEMPLATES) $(GITHUB_TERRAFORM_TEMPLATES) github/init/context.tf

github/init: $(GITHUB_TEMPLATES) $(if $(wildcard *.tf),$(GITHUB_TERRAFORM_TEMPLATES) context)
github/init: $(GITHUB_TEMPLATES) $(if $(wildcard *.tf),$(GITHUB_TERRAFORM_TEMPLATES) github/init/context.tf)
5 changes: 3 additions & 2 deletions templates/terraform/.github/workflows/auto-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
if git diff --no-patch --exit-code context.tf; then
echo "No changes detected! Exiting the job..."
else
echo "context.tf file was updated. Need to rebuild README.md."
echo "context.tf file has changed. Update examples and rebuild README.md."
make init
make github/init/context.tf
make readme/build
echo "::set-output name=create_pull_request=true"
fi
Expand All @@ -34,7 +35,7 @@ jobs:
- name: Create Pull Request
if: {{ steps.update.outputs.create_pull_request == 'true' }}
uses: cloudposse/actions/github/create-pull-request@0.20.0
uses: cloudposse/actions/github/create-pull-request@0.22.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
commit-message: Update context.tf from origin source
Expand Down

0 comments on commit 51ce3b0

Please sign in to comment.