Skip to content

multiple_apps

multiple_apps #39

name: create-issue-branch
on:
issues:
types: [opened]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
create_issue_branch_job:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create Issue Branch
id: create_issue_branch
uses: robvanderleek/create-issue-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Get Issue Description
# id: get_issue_description
# run: |
# echo "Issue title: ${{ github.event.issue.title }}"
# echo "Issue body: ${DESCRIPTION}"
# for line in ${DESCRIPTION}
# do
# echo line
# echo "--"
# done
# env:
# DESCRIPTION: ${{ github.event.issue.body }}
- name: Create new terraform files from template
id: create_new_file
run: |
echo ${{ steps.create_issue_branch.outputs.branchName }}
git checkout -b ${{ steps.create_issue_branch.outputs.branchName }}
for line in ${DESCRIPTION}
do
echo "Creating file for ${line}"
python scripts/drop_rules_create.py --application_name ${line}
echo "file_created=true" >> $GITHUB_ENV
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DESCRIPTION: ${{ github.event.issue.body }}
- name: Commit new files
id: commit_new_file
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
echo ${{ steps.create_issue_branch.outputs.branchName }}
git branch -a
git pull origin ${{ steps.create_issue_branch.outputs.branchName }}
# git add non-compliant-applications/drop_rule_test_app.tf # loop through list of apps in issue
git add .
git commit -m "Add new file to new branch" || echo "No changes to commit"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push new branch
if: env.file_created == 'true'
run: |
git push origin ${{ steps.Create_Issue_Branch.outputs.branchName }}