From 983ea7f7a5371dd608891a0e2a7444a16e9fdc54 Mon Sep 17 00:00:00 2001 From: Dheepak Krishnamurthy Date: Sun, 10 Sep 2023 03:29:06 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20Fix=20check=20for=20if=20breaking=20ch?= =?UTF-8?q?ange=20label=20should=20be=20added=20=E2=99=BB=EF=B8=8F=20(#483?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/check-pr-title.yml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml index fd317117..39c15a75 100644 --- a/.github/workflows/check-pr-title.yml +++ b/.github/workflows/check-pr-title.yml @@ -10,7 +10,7 @@ on: permissions: - pull-requests: read + pull-requests: write jobs: check-title: @@ -28,7 +28,7 @@ jobs: with: header: pr-title-lint-error message: | - Hey there and thank you for opening this pull request! 👋🏼 + Thank you for opening this pull request! We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted. @@ -47,20 +47,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Check breaking change label + id: check_breaking_change run: | title="${{ github.event.pull_request.title }}" - if ! echo "$title" | grep -qE '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!: '; then - echo "::set-output name=breaking_change::true" + pattern='^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!:' + if echo "$title" | grep -qE "$pattern"; then + echo "breaking_change=true" >> $GITHUB_OUTPUT else - echo "::set-output name=breaking_change::false" + echo "breaking_change=false" >> $GITHUB_OUTPUT fi - - name: Add label - if: steps.check.outputs.breaking_change == 'true' + if: steps.check_breaking_change.outputs.breaking_change == 'true' uses: actions/github-script@v6 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | - github.issues.addLabels({ + github.rest.issues.addLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo,