From e226f5426029316e2dcba59934b795cf7f9b8a38 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:48:04 -0300 Subject: [PATCH 1/9] feat: make a new issue --- .github/workflows/broadcast_api_changes.yml | 21 +++++++++++++++++++++ .github/workflows/ci.yml | 2 +- codecovcli_commands | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/broadcast_api_changes.yml diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml new file mode 100644 index 000000000..7dd652107 --- /dev/null +++ b/.github/workflows/broadcast_api_changes.yml @@ -0,0 +1,21 @@ +--- +# yamllint disable rule:line-length + +on: + push: + branches: ['main'] + paths: ['codecovcli_commands'] + pull_request: + paths: ['codecovcli_commands'] + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install GitHub CLI + uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 + - name: Open issue on wrapper + run: | + gh issue create -R codecov/wrapper -t 'New change on CLI' -b $(gh pr diff codecovcli_commands) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1cecc2e2..07587502d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: - name: Run command_dump run: | python command_dump.py - - name: Detect changes + - name: Detect changes on commit run: | if [ -n "$(git diff codecovcli_commands)" ]; then echo "Please run `python command_dump.py` before submitting, or install the hooks" diff --git a/codecovcli_commands b/codecovcli_commands index 932cc7423..4856a8e32 100644 --- a/codecovcli_commands +++ b/codecovcli_commands @@ -1,3 +1,4 @@ +TEST Usage: codecovcli [OPTIONS] COMMAND [ARGS]... Options: From 18948fc8da4aebecfc8ea50b4f585e0ce46c080d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:52:03 -0300 Subject: [PATCH 2/9] fix: add the GH_TOKNE --- .github/workflows/broadcast_api_changes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index 7dd652107..758e80161 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -19,3 +19,5 @@ jobs: - name: Open issue on wrapper run: | gh issue create -R codecov/wrapper -t 'New change on CLI' -b $(gh pr diff codecovcli_commands) + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f78cf0db2087077f1e109daeb941bb2ff88e010e Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:54:03 -0300 Subject: [PATCH 3/9] fix: cant sort --- .github/workflows/broadcast_api_changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index 758e80161..2fb686c1a 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -18,6 +18,6 @@ jobs: uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 - name: Open issue on wrapper run: | - gh issue create -R codecov/wrapper -t 'New change on CLI' -b $(gh pr diff codecovcli_commands) + gh issue create -R codecov/wrapper -t 'New change on CLI' -b "$(gh pr diff)" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 758669731a3003b11e19957e9efd955fa2bd35ce Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:54:31 -0300 Subject: [PATCH 4/9] fix: give it a name --- .github/workflows/broadcast_api_changes.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index 2fb686c1a..ca539f434 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -1,6 +1,8 @@ --- # yamllint disable rule:line-length +name: Broadcast API changes + on: push: branches: ['main'] From a28068a63da0fda09c93168cfad0a5d5053bef4d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:56:23 -0300 Subject: [PATCH 5/9] fix: add the branch --- .github/workflows/broadcast_api_changes.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index ca539f434..cd2d4a464 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -20,6 +20,7 @@ jobs: uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 - name: Open issue on wrapper run: | - gh issue create -R codecov/wrapper -t 'New change on CLI' -b "$(gh pr diff)" + gh issue create -R codecov/wrapper -t 'New change on CLI' -b "$(gh pr diff $BRANCH)" env: + BRANCH: ${{ github.head_ref }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1bd91ffce2ba3a644f57756a1ea1b480375265e0 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 17:57:40 -0300 Subject: [PATCH 6/9] fix: give it permissions --- .github/workflows/broadcast_api_changes.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index cd2d4a464..23c14d3f0 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -13,6 +13,9 @@ on: jobs: run: runs-on: ubuntu-latest + permissions: + contents: read + issues: write steps: - name: Checkout uses: actions/checkout@v4 From 7d86da7ed06596470b309ca757f527c8ff27e948 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 18:00:54 -0300 Subject: [PATCH 7/9] fix: use a different token --- .github/workflows/broadcast_api_changes.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index 23c14d3f0..be94a7dbe 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -19,11 +19,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + - name: Install GitHub CLI uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 + + - name: Generate a token + id: app-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.RELEASER_APP_ID }} + private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }} + repositories: "codecov/wrapper" + - name: Open issue on wrapper run: | gh issue create -R codecov/wrapper -t 'New change on CLI' -b "$(gh pr diff $BRANCH)" env: BRANCH: ${{ github.head_ref }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.app-token.outputs.token }} From cd6668c21427f12da31b7661053f5223c26c4b61 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 18:02:34 -0300 Subject: [PATCH 8/9] fix: release token --- .github/workflows/broadcast_api_changes.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index be94a7dbe..cf2f74cd5 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -23,17 +23,9 @@ jobs: - name: Install GitHub CLI uses: dev-hanz-ops/install-gh-cli-action@v0.1.0 - - name: Generate a token - id: app-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ secrets.RELEASER_APP_ID }} - private-key: ${{ secrets.RELEASER_APP_PRIVATE_KEY }} - repositories: "codecov/wrapper" - - name: Open issue on wrapper run: | gh issue create -R codecov/wrapper -t 'New change on CLI' -b "$(gh pr diff $BRANCH)" env: BRANCH: ${{ github.head_ref }} - GH_TOKEN: ${{ steps.app-token.outputs.token }} + GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} From e84242932993e4cc4035f399c16a12a1c8e0de5e Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Thu, 16 Jan 2025 18:19:42 -0300 Subject: [PATCH 9/9] fix: cleanup --- .github/workflows/broadcast_api_changes.yml | 2 -- codecovcli_commands | 1 - 2 files changed, 3 deletions(-) diff --git a/.github/workflows/broadcast_api_changes.yml b/.github/workflows/broadcast_api_changes.yml index cf2f74cd5..0a26d2e2e 100644 --- a/.github/workflows/broadcast_api_changes.yml +++ b/.github/workflows/broadcast_api_changes.yml @@ -7,8 +7,6 @@ on: push: branches: ['main'] paths: ['codecovcli_commands'] - pull_request: - paths: ['codecovcli_commands'] jobs: run: diff --git a/codecovcli_commands b/codecovcli_commands index 4856a8e32..932cc7423 100644 --- a/codecovcli_commands +++ b/codecovcli_commands @@ -1,4 +1,3 @@ -TEST Usage: codecovcli [OPTIONS] COMMAND [ARGS]... Options: