I'm trying to automatically generate and update documentation for my code in an Azure DevOps Repo. I've configured a pipeline to run a python script upon commit to the master branch. This script pulls the relevant information out from the files in the repository and creates a markdown file and stores the output as README.md
However, when I run the pipeline nothing happens. The job registers as completed but the README.md file is unchanged. I don't get an error come up or anything, so not really sure what is going wrong, maybe a permissions thing. Does anybody know any fix for this?
Pipeline code:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
- script: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python generate-documentation.py
displayName: 'Generate Documentation'
Python script:
import yaml
file = open('single-source.yaml')
documentation = yaml.load(file, Loader=yaml.FullLoader)
productdetails = documentation["product details"]
specifications = documentation["specifications"]
prerequisites = documentation["prerequisites"]
requiredinputs = documentation["required inputs"]
selfservice = documentation["self service"]
costsandcharging = documentation["costs and charging"]
f = open("README.md","w")
for x in productdetails.values():
f.write(x+"\n" )
f = open("README.md","a")
if "specifications" in documentation:
for x in specifications.values():
f.write(x+"\n")
if "prerequisites" in documentation:
for x in prerequisites.values():
f.write(x+"\n")
if "requiredinputs" in documentation:
for x in requiredinputs.values():
f.write(x+"\n")
if "selfservice" in documentation:
for x in selfservice.values():
f.write(x+"\n")
if "costsandcharging" in documentation:
for x in costsandcharging.values():
f.write(x)
f.close()