fosslight / .github

Organization-wide GitHub settings
GNU Affero General Public License v3.0
2 stars 1 forks source link

Divide and abstract complex workflows #1

Open jongwooo opened 10 months ago

jongwooo commented 10 months ago

proposal: Divide and abstract complex workflows

[!IMPORTANT]
Do not link a pull request to this issue(e.g. Closes #1).

Currently, as we look at the repository in our org, each workflow is written in a messy way. For example, the check-commit-message workflow is a duplicate of the same code for each repository.

check-commit-message:
  name: Check Commit Message
  runs-on: ubuntu-latest
  steps:
    - name: Get PR Commits
      id: 'get-pr-commits'
      uses: tim-actions/get-pr-commits@master
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
    - name: Check Subject Line Length
      uses: tim-actions/commit-message-checker-with-regex@v0.3.1
      with:
        commits: ${{ steps.get-pr-commits.outputs.commits }}
        pattern: '^.{0,50}(\n.*)*$'
        error: 'Subject too long (max 50)'
    - name: Check Body Line Length
      if: ${{ success() || failure() }}
      uses: tim-actions/commit-message-checker-with-regex@v0.3.1
      with:
        commits: ${{ steps.get-pr-commits.outputs.commits }}
        pattern: '^.+(\n.{0,72})*$'
        error: 'Body line too long (max 72)'

Duplicate workflows make maintenance difficult and increase the potential for human error.

Rather than using workflow files for each trigger event, we should separate them by functionality and see what we can abstract away along the way.

Gseungmin commented 10 months ago

can I try this? I want to divide and abstract complex workflows