Skip to content

Commit 0cf5736

Browse files
chore(ci): Updating CI to allow tests on docs updates and clean up label logic (#1451)
* chore: Update build to add back storybook for netlify; remove ignore paths to allow doc PRs to merge; update labels for automerge * chore: Remove storybook build; that goes into netlify not here * chore: Add edited to the pull request tasks * chore: Add labeled/unlabeled to label task * chore: Move conventional commit to own task * chore: Cleaning up event triggers * chore: Move comment * chore: Add a run event * chore: Logic was backwards on the label task * chore: Remove event from labeler * chore: Make sure the ready to merge flag exists first * chore: Separate out labels based on firing events * chore: Label logic * chore: Fix or logic * chore: Move WIP label to the label.yml Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 8f18d2e commit 0cf5736

File tree

5 files changed

+127
-40
lines changed

5 files changed

+127
-40
lines changed

.github/workflows/automerge.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
name: Auto-merge pull request if requirements met
44

55
on:
6-
pull_request_review:
7-
types:
8-
- submitted
6+
pull_request:
7+
types: [labeled, unlabeled]
98

109
jobs:
1110
try_to_merge:
@@ -16,7 +15,7 @@ jobs:
1615
uses: pascalgn/[email protected]
1716
env:
1817
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
19-
MERGE_LABELS: "!work in progress!,!on hold,!blocked,!needs: code updates,!needs: additional info,!needs: AT updates,!needs: changelog,!ready: code review,!ready: design review,!ready: branch testing,!ready: browser testing"
18+
MERGE_LABELS: "ready to merge,!work in progress!,!on hold,!blocked,!needs: code updates,!needs: additional info,!needs: AT updates,!needs: changelog,!ready: code review,!ready: design review,!ready: branch testing,!ready: browser testing"
2019
MERGE_REMOVE_LABELS: "ready to merge"
2120
MERGE_METHOD: squash
2221
MERGE_COMMIT_MESSAGE: "pull-request-title"

.github/workflows/cc-format.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will validate the title of a PR to ensure it meets conventional commit standards
2+
name: Validate conventional commit syntax
3+
4+
on:
5+
pull_request:
6+
types: [edited]
7+
8+
env:
9+
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
10+
11+
# Separate jobs can run concurrently
12+
jobs:
13+
cc-format:
14+
name: Validate conventional commit format for title
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Validate conventional commit format for title
19+
id: cc-format
20+
uses: aslafy-z/[email protected]
21+
continue-on-error: true
22+
with:
23+
success-state: Title follows the conventional commit format.
24+
failure-state: Please update the title to use conventional commit format.
25+
context-name: conventional-pr-title
26+
preset: conventional-changelog-angular@latest
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/label.yml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
# This workflow will triage pull requests and apply a label based on the
22
# paths that are modified in the pull request.
3-
#
4-
# To view the configuration, go to: .github/labeler.yml
53
name: Auto-label PRs
64

75
on:
86
pull_request:
9-
types:
10-
- opened
11-
- convert_to_draft
12-
- ready_for_review
13-
pull_request_review:
14-
types: [submitted]
7+
types: [opened, synchronize]
8+
# paths:
9+
# - examples/*
10+
# - elements/*/demo/*
11+
# - generators/**/*
12+
# - docs/**/*
13+
# - elements/**/*.{md,txt}
14+
# - elements/*/src/*.{js,html}
15+
# - elements/*/src/*.{scss,css}
16+
# - tokens/**/*
17+
# - elements/*/test/*
18+
# - scripts/*
19+
# - elements/*/gulpfile.js
20+
# - elements/*/rollup.config.js
21+
# - .github/**/*
22+
# - ./.*
23+
# - ./*.{js,json,yml}
1524

1625
env:
1726
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
1827

19-
# Separate jobs can run concurrently
2028
jobs:
29+
# To view the configuration, go to: .github/labeler.yml
2130
triage:
2231
name: Apply triage labels
2332
runs-on: ubuntu-latest
@@ -27,29 +36,16 @@ jobs:
2736
with:
2837
repo-token: ${{ env.TOKEN }}
2938

30-
mergeable:
31-
name: Flag a PR ready to merge
32-
runs-on: ubuntu-latest
33-
34-
steps:
35-
- name: Flag ready to merge
36-
# Add a ready to merge label if the PR is approved and the test suite has passed
37-
if: |
38-
!contains(github.event.pull_request.labels.*.name, 'on hold') &&
39-
!contains(github.event.pull_request.labels.*.name, 'work in progress') &&
40-
github.event.review.state == 'approved'
41-
uses: actions-ecosystem/action-add-labels@v1
42-
with:
43-
github_token: ${{ env.TOKEN }}
44-
labels: ready to merge
45-
4639
in-progress:
4740
name: Flag a PR as work-in-progress if in draft
4841
runs-on: ubuntu-latest
4942

5043
steps:
5144
- name: Flag work in progress
52-
if: github.event.pull_request.draft == true
45+
if: |
46+
github.event.pull_request.draft == true &&
47+
!contains(github.event.pull_request.labels.*.name, 'on hold') &&
48+
!contains(github.event.pull_request.labels.*.name, 'blocked')
5349
uses: actions-ecosystem/action-add-labels@v1
5450
with:
5551
github_token: ${{ env.TOKEN }}

.github/workflows/merge-label.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This workflow will triage pull requests and apply a label based on the
2+
# paths that are modified in the pull request.
3+
name: Auto-label PRs
4+
5+
on:
6+
pull_request:
7+
types: [opened, labeled, unlabeled]
8+
pull_request_review:
9+
types: [submitted]
10+
11+
env:
12+
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
13+
14+
# Separate jobs can run concurrently
15+
jobs:
16+
mergeable:
17+
name: Label a PR's merge status
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Check labels
22+
id: block-merge
23+
if: |
24+
contains(github.event.pull_request.labels.*.name, 'on hold') ||
25+
contains(github.event.pull_request.labels.*.name, 'work in progress') ||
26+
contains(github.event.pull_request.labels.*.name, 'blocked') ||
27+
contains(github.event.pull_request.labels.*.name, 'needs: discussion') ||
28+
contains(github.event.pull_request.labels.*.name, 'needs: dev discovery') ||
29+
contains(github.event.pull_request.labels.*.name, 'needs: changelog') ||
30+
contains(github.event.pull_request.labels.*.name, 'needs: prioritization') ||
31+
contains(github.event.pull_request.labels.*.name, 'needs: AT updates') ||
32+
contains(github.event.pull_request.labels.*.name, 'needs: additional info') ||
33+
contains(github.event.pull_request.labels.*.name, 'needs: code updates') ||
34+
contains(github.event.pull_request.labels.*.name, 'needs: baseline updates') ||
35+
contains(github.event.pull_request.labels.*.name, 'needs: documentation updates') ||
36+
contains(github.event.pull_request.labels.*.name, 'ready: code review') ||
37+
contains(github.event.pull_request.labels.*.name, 'ready: browser testing') ||
38+
contains(github.event.pull_request.labels.*.name, 'ready: branch testing') ||
39+
contains(github.event.pull_request.labels.*.name, 'ready: design review') ||
40+
github.event.review.state != 'approved'
41+
run: echo "PR not ready to merge."
42+
43+
- name: Flag ready to merge
44+
# Add a ready to merge label if the PR is approved
45+
# ensure the PR is not on hold, in-progress, or blocked & doesn't have any pending
46+
# requirements still to do like needing a changelog or AT updates
47+
if: steps.block-merge.outcome == 'Skipped'
48+
uses: actions-ecosystem/action-add-labels@v1
49+
with:
50+
github_token: ${{ env.TOKEN }}
51+
labels: ready to merge
52+
53+
- name: Remove ready to merge flag
54+
# Remove the ready to merge label if the PR is not approved or certain labels are added
55+
if: |
56+
steps.block-merge.outcome != 'Skipped' &&
57+
contains(github.event.pull_request.labels.*.name, 'ready to merge')
58+
uses: actions-ecosystem/action-remove-labels@v1
59+
with:
60+
github_token: ${{ env.TOKEN }}
61+
labels: ready to merge

.github/workflows/tests.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ on:
1111
- synchronize
1212
- labeled
1313
- ready_for_review
14+
# TODO: build is required for merging so we can't ignore these
1415
# Will only run if files other than these are edited
15-
paths-ignore:
16-
- ".github/ISSUE_TEMPLATE/**"
17-
- ".github/PULL_REQUEST_TEMPLATE/**"
18-
- ".storybook/**"
19-
- "docs/**"
20-
- "generators/**"
21-
- "**/*.md"
22-
- "**/*.text"
23-
- "*.md"
16+
# paths-ignore:
17+
# - ".github/ISSUE_TEMPLATE/**"
18+
# - ".github/PULL_REQUEST_TEMPLATE/**"
19+
# - ".storybook/**"
20+
# - "docs/**"
21+
# - "generators/**"
22+
# - "**/*.md"
23+
# - "**/*.text"
24+
# - "*.md"
2425
# Build when PRs are merged into master/main
2526
push:
2627
branches: [master, main]
@@ -53,11 +54,13 @@ jobs:
5354
# Confirm that the PR is not in draft
5455
if: |
5556
(
56-
github.event_name == 'labeled' &&
57+
github.event_name == 'pull_request' &&
58+
github.event.action == 'labeled' &&
5759
(github.event.label.name == 'run e2e' || github.event.label.name == 'ready to merge')
5860
) ||
5961
(
6062
github.event_name == 'pull_request' &&
63+
github.event.action != 'labeled' &&
6164
github.event.pull_request.draft == false
6265
) ||
6366
github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)