From 3eb3b22c7b1cfb64b98785a8793608fb2a4fdd25 Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 13 Nov 2023 11:28:11 +1100 Subject: [PATCH] ci: Automatically prepend CC to GH PR title --- .github/workflows/cc.yml | 24 ++++++++++++++++++++++++ bin/.gptcc-0.0.1.pkg | 1 + bin/gptcc | 1 + 3 files changed, 26 insertions(+) create mode 100644 .github/workflows/cc.yml create mode 120000 bin/.gptcc-0.0.1.pkg create mode 120000 bin/gptcc diff --git a/.github/workflows/cc.yml b/.github/workflows/cc.yml new file mode 100644 index 0000000000..7fbd6f1eb8 --- /dev/null +++ b/.github/workflows/cc.yml @@ -0,0 +1,24 @@ +on: + push: + branches: + - main + pull_request: +name: Conventional Commits +jobs: + cc: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} + - uses: cashapp/activate-hermit@v1 + - name: Update PR title + run: | + orig="${{ github.event.pull_request.title }}" + modified="$(gptcc "$orig")" + diff -u <(echo "$orig") <(echo "$modified") | tail +4 || true + gh pr edit --title "$modified" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} diff --git a/bin/.gptcc-0.0.1.pkg b/bin/.gptcc-0.0.1.pkg new file mode 120000 index 0000000000..383f4511d4 --- /dev/null +++ b/bin/.gptcc-0.0.1.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/gptcc b/bin/gptcc new file mode 120000 index 0000000000..53b61d9a74 --- /dev/null +++ b/bin/gptcc @@ -0,0 +1 @@ +.gptcc-0.0.1.pkg \ No newline at end of file