Bulk Issues Creation #158
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Bulk Issues Creation | |
on: | |
workflow_dispatch: | |
inputs: | |
organization_name: | |
description: 'Github organization for the listed repos' | |
type: choice | |
required: true | |
default: farhan-test-org | |
options: | |
- openedx | |
- edx | |
- farhan-test-org | |
repositories: | |
description: 'Comma-separated list of repositories' | |
required: true | |
type: string | |
issue_title: | |
description: 'Issue title' | |
required: true | |
type: string | |
issue_description: | |
description: 'Issue description (Markdown supported)' | |
required: true | |
type: string | |
issue_labels: | |
description: 'Comma-separated list of issue labels' | |
required: true | |
type: string | |
jobs: | |
create_issues: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up GitHub CLI | |
uses: actions/setup-node@v4 | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gh | |
- name: Authenticate GitHub CLI | |
run: | | |
echo "${{ secrets.requirements_bot_github_token }}" | gh auth login --with-token | |
git config --global user.email "${{ secrets.requirements_bot_github_email }}" | |
git config --global user.name "edx-requirements-bot" | |
- name: Create issues in repositories | |
run: | | |
ORG_NAME="${{ github.event.inputs.organization_name }}" | |
REPOS="${{ github.event.inputs.repositories }}" | |
TITLE="${{ github.event.inputs.issue_title }}" | |
DESCRIPTION="${{ github.event.inputs.issue_description }}" | |
LABELS="${{ github.event.inputs.issue_labels }}" | |
IFS=',' read -ra REPO_ARRAY <<< "$REPOS" | |
ISSUE_URLS="" | |
for REPO in "${REPO_ARRAY[@]}"; do | |
gh issue create --repo "$ORG_NAME/$REPO" --title "$TITLE" --body "$DESCRIPTION" --label "$LABELS" | |
ISSUE_URL=$(gh issue view --repo "$ORG_NAME/$REPO" --json url --jq '.url' --title "$TITLE") | |
ISSUE_URLS="$ISSUE_URLS$ISSUE_URL\n" | |
done | |
echo -e "$ISSUE_URLS" > issue_urls.txt | |
- name: Upload issue URLs as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: issue-urls | |
path: issue_urls.txt |