Skip to content

Commit

Permalink
feat: use unified workflows (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramizpolic authored Nov 29, 2023
1 parent adb19d9 commit 4b6c1d7
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 98 deletions.
8 changes: 4 additions & 4 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@

- name: 'size/S'
color: '77bb02'
description: 'Denotes a PR that changes 10-49 lines'
description: 'Denotes a PR that changes 10-99 lines'

- name: 'size/M'
color: 'eebb03'
description: 'Denotes a PR that changes 50-99 lines'
description: 'Denotes a PR that changes 100-499 lines'

- name: 'size/L'
color: 'ee9902'
description: 'Denotes a PR that changes 100-499 lines'
description: 'Denotes a PR that changes 500-999 lines'

- name: 'size/XL'
color: 'ed5500'
description: 'Denotes a PR that changes 500+ lines'
description: 'Denotes a PR that changes 1000+ lines'

# Kind
- name: 'kind/design'
Expand Down
41 changes: 28 additions & 13 deletions .github/workflows/_pr_check.yml → .github/workflows/_pr-sync.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
name: _pr_check
# This action needs works for "pull_request" and "pull_request_target" triggers

name: _pr-sync

on:
workflow_call:
inputs:
# New line separated list of valid commit types => type(scope): message
commit-types:
type: string
required: false
# New line separated list of valid commit scopes => type(scope): message
commit-scopes:
type: string
required: false

jobs:
validate-title:
Expand All @@ -21,9 +14,6 @@ jobs:
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: ${{ inputs.commit-types }}
scopes: ${{ inputs.commit-scopes }}

# Leave a comment if linter reports an error
- uses: marocchino/sticky-pull-request-comment@v2
Expand Down Expand Up @@ -55,3 +45,28 @@ jobs:
- uses: Morishiri/[email protected]
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

size-labeler:
runs-on: ubuntu-latest
name: Label size
steps:
- uses: codelytv/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xs_label: 'size/XS'
xs_max_size: '10'
s_label: 'size/S'
s_max_size: '100'
m_label: 'size/M'
m_max_size: '500'
l_label: 'size/L'
l_max_size: '1000'
xl_label: 'size/XL'
fail_if_xl: 'false'
message_if_xl: >
This PR exceeds the recommended size of 1000 lines.
Please make sure you are NOT addressing multiple issues with one PR.
Note that this PR might be rejected due to its size.
github_api_url: 'api.github.com'
files_to_ignore: |
"*.md"
30 changes: 0 additions & 30 deletions .github/workflows/_pr_sync.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: _stale
# This action works for any trigger

name: _project-sync

on:
workflow_call:
Expand All @@ -22,6 +24,7 @@ on:

jobs:
stale:
name: Mark stale
runs-on: ubuntu-latest
steps:
- name: 📆 mark stale activity
Expand Down Expand Up @@ -56,3 +59,23 @@ jobs:
This PR has been marked `stale` for ${{ inputs.days-until-close }}
days, and is now closed due to inactivity. If this contribution is
still relevant, please re-open this PR or file a new one. Thank you!
labels:
name: Sync project labels
runs-on: ubuntu-latest
steps:
- uses: EndBug/label-sync@v2
with:
# If you want to use a config file, you can put its path or URL here, multiple files are also allowed (more info in the paragraphs below)
# TODO (@ramizpolic): Enable per-project labels via e.g. .github/labels.yml in workflow_call
config-file: |
https://raw.githubusercontent.com/bank-vaults/.github/main/.github/labels.yml
# If you want to delete any additional label, set this to true
delete-other-labels: false

# If you want the action just to show you the preview of the changes, without actually editing the labels, set this to true
dry-run: false

# You can change the token used to change the labels, this is the default one
token: ${{ secrets.GITHUB_TOKEN }}
25 changes: 0 additions & 25 deletions .github/workflows/_sync.yml

This file was deleted.

9 changes: 2 additions & 7 deletions .github/workflows/pr-sync.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pr-sync
name: PR

on:
pull_request_target:
Expand All @@ -9,13 +9,8 @@ on:
- synchronize

jobs:
check:
uses: ./.github/workflows/_pr_check.yml
permissions:
pull-requests: write

sync:
uses: ./.github/workflows/_pr_sync.yml
uses: ./.github/workflows/_pr-sync.yml
permissions:
pull-requests: write
issues: write
13 changes: 13 additions & 0 deletions .github/workflows/project-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Project

on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:

jobs:
sync:
uses: ./.github/workflows/_project-sync.yml
permissions:
issues: write
pull-requests: write
18 changes: 0 additions & 18 deletions .github/workflows/sync.yml

This file was deleted.

0 comments on commit 4b6c1d7

Please sign in to comment.