Skip to content

Commit

Permalink
Update azure-pipelines-pr.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
spy86 authored Jan 21, 2025
1 parent 860d2f0 commit 06951f7
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions pipelines/azure-pipelines-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,26 @@ stages:
chmod +x /tmp/terraform-docs
displayName: 'Download terraform-docs'
- script: |
# Variables
github_token="$(GITHUB_TOKEN)"
# Generate or update README.md
/tmp/terraform-docs markdown table . > README.md
# Check if README.md has been updated or created and add to PR
if [ -f README.md ]; then
echo "README.md file generated/updated."
# Check for changes in README.md
if git diff --name-only | grep -q README.md; then
echo "README.md file updated. Preparing to commit changes."
git config --global user.email "devops-bot@example.com"
git config --global user.name "DevOps Bot"
git add README.md
git commit -m "Update README.md with module documentation"
# Set remote URL with authentication token
git remote set-url origin https://$(GITHUB_TOKEN)@github.com/Think-Cube/terraform-azure-resource-group.git
# Pull the latest changes to avoid conflicts (source branch of the PR)
git pull origin '$(System.PullRequest.SourceBranch)' --rebase
git pull origin '$(System.PullRequest.SourceBranch)' --rebase || exit 1
# Push changes
git push origin HEAD:'$(System.PullRequest.SourceBranch)'
git push origin HEAD:'$(System.PullRequest.SourceBranch)' || exit 1
else
echo "Failed to generate README.md"
exit 1
echo "No changes in README.md detected."
fi
displayName: 'Generate and Update README.md Documentation'

0 comments on commit 06951f7

Please sign in to comment.