Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: extend init param with file creation for gh action #198

Closed
7 tasks done
Tracked by #45
BioPhoton opened this issue Jan 30, 2023 · 0 comments · Fixed by #205
Closed
7 tasks done
Tracked by #45

feat: extend init param with file creation for gh action #198

BioPhoton opened this issue Jan 30, 2023 · 0 comments · Fixed by #205
Labels
DX Developer Experience

Comments

@BioPhoton
Copy link
Contributor

BioPhoton commented Jan 30, 2023

Motivation

Create a scaffolding a workflow.yml file to integrate the GitHub action into the a repository.

Following things are related:

This feature in general will help to get access to all features related to CI automations.

Implementation

The init command will extend with one optinolan param generateGhWorkflow.

Option Type Default Description
-g, --generateGhWorkflow boolean n/a Generate user-flow.yml file under .github/workflows

Execution:
npx user-flow init --generateGhWorkflow

Description:

This command creates a GitHub workflow .github/workflows/user-flow.yml with the following content:

user-flow.yml

name: user-flow-gh-action-example
on:
  pull_request:
jobs:
  user-flow:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [18.x]
    steps:
      - uses: actions/checkout@v2
      - name: Executing user-flow CLI
        uses: push-based/user-flow-gh-action@v<VERSION>

It will also prompt a hit for the user for possible next steps.
e.g. "GitHub workflow for user-flow integration set up under .github/workflows/user-flow.yml"

Todos

  • Documantation
  • Implementation
    • add logic to process CLI params for --generateGhWorkflow alias -g as boolean no default value
    • add logic that composes this feature into commands/init/processes/generateGhWorkflow.ts
    • implement prompts to ask the user
    • integrate the generateGhWorkflow process into the init command
  • Testing
    • test the function in isolation

Cases and combinations of parameters

**Legend:**  
- [nf] - flow file does not exist
- [f] - flow file does exist
- [F] - flow file creation
- [nF] - no flow file creation
- [P] - Prompt executes
- [L] - Log occurs
- [N] - no operation

Cases:

  • [nf] init --interactive => [P]: "Setup workflow" -> Y:[F]/n[nF],
  • [f] init --interactive => [L]: "File already here"; [nF]
  • [nf] init --no-interactive => [N]
  • [f] init --no-interactive => [N]
  • [nf] init --interactive --generateGhWorkflow=> [L]: "File already here"; [nF]
  • [f] init --interactive --generateGhWorkflow=> [F]
  • [f] init --interactive --no-generateGhWorkflow=> [N]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer Experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant