From 4d487e537257a722709d499fbe13b78addb86caa Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Tue, 20 Dec 2022 10:43:45 -0500 Subject: [PATCH 1/3] ci: enforce semantic PR title Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- .github/workflows/pr-title-check.yml | 41 ++++++++++++++++++++++++++++ .github/workflows/update-snyk.yaml | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-title-check.yml diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml new file mode 100644 index 0000000000000..847b48e4885ec --- /dev/null +++ b/.github/workflows/pr-title-check.yml @@ -0,0 +1,41 @@ +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +permissions: + contents: read + +jobs: + main: + permissions: + pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs + statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR + name: Validate PR title + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@01d5fd8a8ebb9aafe902c40c53f0f4744f7381eb # v5.0.2 + with: + types: | + feat + fix + docs + test + ci + chore + [Bot] docs + scopes: | + controller + applicationset + repo-server + api + ui + deps + cli + requireScope: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/update-snyk.yaml b/.github/workflows/update-snyk.yaml index 02c83f6fab78a..3dd74e86f8404 100644 --- a/.github/workflows/update-snyk.yaml +++ b/.github/workflows/update-snyk.yaml @@ -31,6 +31,6 @@ jobs: git config --global user.email 'ci@argoproj.com' git config --global user.name 'CI' git add docs/snyk - git commit -m "[Bot] Update Snyk reports" --signoff + git commit -m "[Bot] docs: Update Snyk reports" --signoff git push --set-upstream origin "$pr_branch" gh pr create -B master -H "$pr_branch" --title '[Bot] docs: Update Snyk report' --body '' From 820b3f62e568e384d62cdfa4c33b5716528687f2 Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Tue, 20 Dec 2022 12:03:59 -0500 Subject: [PATCH 2/3] concurrency limit Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- .github/workflows/pr-title-check.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index 847b48e4885ec..e204a21617fd6 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -10,6 +10,12 @@ on: permissions: contents: read +# PR updates can happen in quick succession leading to this +# workflow being trigger a number of times. This limits it +# to one run per PR. +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: main: permissions: From b876253a63de9179f6528f182e00f45bd6749d8c Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Wed, 21 Dec 2022 13:26:17 -0500 Subject: [PATCH 3/3] remove scopes Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- .github/workflows/pr-title-check.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/pr-title-check.yml b/.github/workflows/pr-title-check.yml index e204a21617fd6..f1e80e237ce44 100644 --- a/.github/workflows/pr-title-check.yml +++ b/.github/workflows/pr-title-check.yml @@ -34,14 +34,5 @@ jobs: ci chore [Bot] docs - scopes: | - controller - applicationset - repo-server - api - ui - deps - cli - requireScope: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}