From bb0d0d0f7ea919118d275c0c10833ced6297db96 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 9 Feb 2024 23:20:38 +0100 Subject: [PATCH] move secrets to workflow --- .../generate-sandboxes-composite-action/action.yml | 10 ++++++++-- .github/workflows/generate-sandboxes.yml | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/actions/generate-sandboxes-composite-action/action.yml b/.github/actions/generate-sandboxes-composite-action/action.yml index e2d84a2c283d..a4f0112731e7 100644 --- a/.github/actions/generate-sandboxes-composite-action/action.yml +++ b/.github/actions/generate-sandboxes-composite-action/action.yml @@ -5,6 +5,12 @@ inputs: destination-branch: description: The destination branch to generate sandboxes to in the storybookjs/sandboxes repository required: true + token: + description: The personal access token to use when authenticating with the destination repository + required: true + discord-url: + description: The Discord URL to use when reporting failures + required: true runs: using: "composite" @@ -50,12 +56,12 @@ runs: - name: Publish shell: bash - run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT}}@github.com/storybookjs/sandboxes.git --push --branch=${{ inputs.destination-branch }} + run: yarn publish-sandboxes --remote=https://storybook-bot:${{ inputs.token }}@github.com/storybookjs/sandboxes.git --push --branch=${{ inputs.destination-branch }} - name: The job has failed if: ${{ failure() || cancelled() }} env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }} + DISCORD_WEBHOOK: ${{ inputs.discord-url }} uses: Ilshidur/action-discord@master with: args: "The generation of sandboxes in the **${{ inputs.destination-branch }}** branch has failed. [View Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" diff --git a/.github/workflows/generate-sandboxes.yml b/.github/workflows/generate-sandboxes.yml index 0f6b5e992e7d..942ad7527d42 100644 --- a/.github/workflows/generate-sandboxes.yml +++ b/.github/workflows/generate-sandboxes.yml @@ -15,6 +15,7 @@ on: jobs: generate-next: + name: Generate to next runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -23,7 +24,11 @@ jobs: - uses: ./.github/actions/generate-sandboxes-composite-action with: destination-branch: next + token: ${{ secrets.PAT_STORYBOOK_BOT }} + discord-url: ${{ secrets.DISCORD_MONITORING_URL }} + # generate-main: + # name: Generate to main # runs-on: ubuntu-latest # steps: # - uses: actions/checkout@v4 @@ -32,3 +37,5 @@ jobs: # - uses: ./.github/actions/generate-sandboxes-composite-action # with: # destination-branch: main + # token: ${{ secrets.PAT_STORYBOOK_BOT }} + # discord-url: ${{ secrets.DISCORD_MONITORING_URL }}