Skip to content

User Story: Ugrade wtith python #4

User Story: Ugrade wtith python

User Story: Ugrade wtith python #4

name: Add New User Story
on:
issues:
types: [closed]
workflow_dispatch:
inputs:
log-level:
description: Log Level
required: true
type: choice
options:
- debug
- info
- warning
- error
- critical
issue-number:
description: Related Issue Number
required: true
type: string
status:
description: Status of the user story
required: true
type: string
permissions: write-all
env:
MK_USERNAME: ${{ secrets.MK_USERNAME }}
MK_EMAIL: ${{ secrets.MK_EMAIL }}
PYTHONPATH: ${{ github.workspace }}/.github/scripts/
jobs:
add-user-story:
runs-on: ubuntu-latest
if: contains(github.event.issue.labels.*.name, 'user-story')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Use token to allow force push
token: ${{ secrets.MK_TOKEN }}
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup User Story
run: pip install git+https://github.com/mkpro118/[email protected]
- name: Add User Story to Document
if: ${{ github.event_name == 'issues' }}
run: |
user_story --log-level debug update \
--issue-number ${{ github.event.issue.number }} \
--status "Completed" \
- name: Add User Story to Document (manual dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
user_story --log-level ${{ inputs.log-level }} \
update \
--issue-number ${{ inputs.issue_number }} \
--status ${{ inputs.status }} \
- name: Commit files
run: |
git config --local user.name ${MK_USERNAME}
git config --local user.email ${MK_EMAIL}
git add docs/user-story/README.md
if ! git diff-index --quiet HEAD; then
echo "Changes detected. Committing..."
git commit -m "Updated User Stories [auto-built]"
git push -f origin main
else
echo "No changes detected."
fi