From a82f93b6505e93c7ccafad4c7fa3fef72983df79 Mon Sep 17 00:00:00 2001 From: Kaspar Lyngsie Date: Tue, 17 Jun 2025 20:40:38 +0200 Subject: [PATCH 1/4] chore: fixing bad path for README in user-docs --- .github/workflows/sync-cli-help-to-user-docs.yml | 4 ++-- .github/workflows/sync-cli-readme.yml | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-cli-help-to-user-docs.yml b/.github/workflows/sync-cli-help-to-user-docs.yml index f86da99170..6d4329771e 100644 --- a/.github/workflows/sync-cli-help-to-user-docs.yml +++ b/.github/workflows/sync-cli-help-to-user-docs.yml @@ -18,16 +18,16 @@ jobs: with: repository: snyk/user-docs path: user-docs + fetch-depth: 0 ref: main - name: Checkout cli repository uses: actions/checkout@v4 with: repository: snyk/cli - ref: ${{ github.ref_name }} path: cli - token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 + ref: ${{ github.ref_name }} - name: Configure git user run: | diff --git a/.github/workflows/sync-cli-readme.yml b/.github/workflows/sync-cli-readme.yml index 64b3c495e5..820c88fee2 100644 --- a/.github/workflows/sync-cli-readme.yml +++ b/.github/workflows/sync-cli-readme.yml @@ -18,6 +18,7 @@ jobs: with: repository: snyk/user-docs path: user-docs + fetch-depth: 0 ref: main - name: Checkout cli repository @@ -25,8 +26,8 @@ jobs: with: repository: snyk/cli path: cli - token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 + ref: main - name: Configure git user run: | @@ -49,7 +50,7 @@ jobs: - name: Retrieve GitBook content and update README run: | - cp ./docs/snyk-cli/getting-started-with-the-snyk-cli.md ./cli/README.md + cp ./user-docs/docs/snyk-cli/getting-started-with-the-snyk-cli.md ./cli/README.md # GitBook Markdown files often use relative paths for assets (e.g., images) # like `../.gitbook/assets/image.png`. When this README.md is viewed directly From 0b80168cc30d9b82fe8cca62116e7eb788aaa5a1 Mon Sep 17 00:00:00 2001 From: Kaspar Lyngsie Date: Tue, 17 Jun 2025 20:40:58 +0200 Subject: [PATCH 2/4] chore: signing commits, though unsure if it works for the github actions user --- .github/workflows/sync-cli-help-to-user-docs.yml | 2 +- .github/workflows/sync-cli-readme.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-cli-help-to-user-docs.yml b/.github/workflows/sync-cli-help-to-user-docs.yml index 6d4329771e..920128b811 100644 --- a/.github/workflows/sync-cli-help-to-user-docs.yml +++ b/.github/workflows/sync-cli-help-to-user-docs.yml @@ -79,7 +79,7 @@ jobs: run: | cd ./cli git add help - git commit -m "${{ env.COMMIT_MESSAGE }}" + git commit -S -m "${{ env.COMMIT_MESSAGE }}" git push --force --set-upstream origin ${{ env.DESTINATION_BRANCH }} - name: Create or update a pull request diff --git a/.github/workflows/sync-cli-readme.yml b/.github/workflows/sync-cli-readme.yml index 820c88fee2..651cd3b9d5 100644 --- a/.github/workflows/sync-cli-readme.yml +++ b/.github/workflows/sync-cli-readme.yml @@ -91,7 +91,7 @@ jobs: run: | cd ./cli git add help - git commit -m "${{ env.COMMIT_MESSAGE }}" + git commit -S -m "${{ env.COMMIT_MESSAGE }}" git push --force --set-upstream origin ${{ env.DESTINATION_BRANCH }} - name: Create or update a pull request From c8f4a7ca53a195f98f3af50a4b44ae868b71b253 Mon Sep 17 00:00:00 2001 From: Kaspar Lyngsie Date: Tue, 17 Jun 2025 20:59:18 +0200 Subject: [PATCH 3/4] fix: not adding /help, but readme.md --- .github/workflows/sync-cli-readme.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-cli-readme.yml b/.github/workflows/sync-cli-readme.yml index 651cd3b9d5..ed149d5775 100644 --- a/.github/workflows/sync-cli-readme.yml +++ b/.github/workflows/sync-cli-readme.yml @@ -90,7 +90,7 @@ jobs: if: steps.check_changes.outputs.continue == 'true' run: | cd ./cli - git add help + git add README.md git commit -S -m "${{ env.COMMIT_MESSAGE }}" git push --force --set-upstream origin ${{ env.DESTINATION_BRANCH }} From dc91cbcf8e72a61eef8113dd8d06aa53057dfa97 Mon Sep 17 00:00:00 2001 From: Kaspar Lyngsie Date: Tue, 17 Jun 2025 21:16:35 +0200 Subject: [PATCH 4/4] chore: signing commits with Team CLI Bot --- .github/workflows/sync-cli-help-to-user-docs.yml | 14 ++++++++++---- .github/workflows/sync-cli-readme.yml | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync-cli-help-to-user-docs.yml b/.github/workflows/sync-cli-help-to-user-docs.yml index 920128b811..d73287247a 100644 --- a/.github/workflows/sync-cli-help-to-user-docs.yml +++ b/.github/workflows/sync-cli-help-to-user-docs.yml @@ -29,12 +29,18 @@ jobs: fetch-depth: 0 ref: ${{ github.ref_name }} - - name: Configure git user + - name: Configure Git user run: | - git config --global user.email "noreply@snyk.io" + git config --global user.name "Team CLI Bot" + git config --global user.email "team-cli@snyk.io" - # GITHUB_ACTOR: The name of the person or app that initiated the workflow. - git config --global user.name "$GITHUB_ACTOR" + - name: Import and configure GPG + run: | + echo "$GPG_KEY" | gpg --batch --import + gpg --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --batch --sign + env: + GPG_KEY: ${{ secrets.TEAM_CLI_BOT_GPG_KEY }} + GPG_PASSPHRASE: ${{ secrets.TEAM_CLI_BOT_GPG_PASSPHRASE }} - name: Create or checkout destination branch run: | diff --git a/.github/workflows/sync-cli-readme.yml b/.github/workflows/sync-cli-readme.yml index ed149d5775..4c92477351 100644 --- a/.github/workflows/sync-cli-readme.yml +++ b/.github/workflows/sync-cli-readme.yml @@ -29,12 +29,18 @@ jobs: fetch-depth: 0 ref: main - - name: Configure git user + - name: Configure Git user run: | - git config --global user.email "noreply@snyk.io" + git config --global user.name "Team CLI Bot" + git config --global user.email "team-cli@snyk.io" - # GITHUB_ACTOR: The name of the person or app that initiated the workflow. - git config --global user.name "$GITHUB_ACTOR" + - name: Import and configure GPG + run: | + echo "$GPG_KEY" | gpg --batch --import + gpg --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --batch --sign + env: + GPG_KEY: ${{ secrets.TEAM_CLI_BOT_GPG_KEY }} + GPG_PASSPHRASE: ${{ secrets.TEAM_CLI_BOT_GPG_PASSPHRASE }} - name: Create or checkout destination branch run: |