From 747d323584a288a7e6e98849ff9dae4b61753cb8 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Wed, 17 May 2023 07:39:36 +0000 Subject: ci: fix breaking on foreign repos --- .github/workflows/storybook.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index b04f4260c3..8ca28c2ba9 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -16,12 +16,19 @@ jobs: steps: - uses: actions/checkout@v3.3.0 + if: github.event_name != 'pull_request_target' with: fetch-depth: 0 submodules: true - - name: Checkout HEAD + - uses: actions/checkout@v3.3.0 + if: github.event_name == 'pull_request_target' + with: + fetch-depth: 0 + submodules: true + ref: "refs/pull/${{ github.event.number }}/merge" + - name: Checkout actual HEAD if: github.event_name == 'pull_request_target' - run: git checkout ${{ github.head_ref }} + run: git checkout $(git rev-list --parents -n1 HEAD | cut -d" " -f3) - name: Install pnpm uses: pnpm/action-setup@v2 with: -- cgit v1.2.3-freya From 6bb82cda37f56432a527a812a90b73861e38788a Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Thu, 18 May 2023 14:16:07 +0900 Subject: ci: use actual base --- .github/workflows/storybook.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 8ca28c2ba9..72528f95b5 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -28,7 +28,10 @@ jobs: ref: "refs/pull/${{ github.event.number }}/merge" - name: Checkout actual HEAD if: github.event_name == 'pull_request_target' - run: git checkout $(git rev-list --parents -n1 HEAD | cut -d" " -f3) + id: rev + run: | + echo "base=$(git rev-list --parents -n1 HEAD | cut -d" " -f2)" >> $GITHUB_OUTPUT + git checkout $(git rev-list --parents -n1 HEAD | cut -d" " -f3) - name: Install pnpm uses: pnpm/action-setup@v2 with: @@ -75,7 +78,7 @@ jobs: if: github.event_name == 'pull_request_target' id: chromatic_pull_request run: | - DIFF="${{ github.base_ref }} HEAD" + DIFF="${{ steps.rev.outputs.base }} HEAD" if [ "$DIFF" = "0000000000000000000000000000000000000000 HEAD" ]; then DIFF="HEAD" fi -- cgit v1.2.3-freya From 6173cebdca246f9e1b496d66c237ce4afc60dc31 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Thu, 18 May 2023 08:05:09 +0000 Subject: ci: remove deprecated notifications --- .github/workflows/storybook.yml | 12 ------------ 1 file changed, 12 deletions(-) (limited to '.github/workflows') diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 72528f95b5..a9a5be7588 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -101,18 +101,6 @@ jobs: commit_sha: context.sha, body: 'Chromatic detects changes. Please [review the changes on Chromatic](https://www.chromatic.com/builds?appId=6428f7d7b962f0b79f97d6e4).' }) - - name: Notify that Chromatic will skip testing - uses: actions/github-script@v6.4.0 - if: github.event_name == 'pull_request_target' && steps.chromatic_pull_request.outputs.skip == 'true' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Chromatic will skip testing but you may still have to [review the changes on Chromatic](https://www.chromatic.com/pullrequests?appId=6428f7d7b962f0b79f97d6e4).' - }) - name: Upload Artifacts uses: actions/upload-artifact@v3 with: -- cgit v1.2.3-freya From 22a6bd6b22314185319f4d092a277fbf8ac07ce9 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sat, 20 May 2023 14:03:05 +0000 Subject: ci: fix branch name --- .github/workflows/storybook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index a9a5be7588..19a03e5dea 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -86,7 +86,7 @@ jobs: if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then echo "skip=true" >> $GITHUB_OUTPUT fi - pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static $(echo "$CHROMATIC_PARAMETER") + pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name ${{ github.event.pull_request.head.ref }} $(echo "$CHROMATIC_PARAMETER") env: CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - name: Notify that Chromatic detects changes -- cgit v1.2.3-freya From 9a6ce1e86786756c73286b08d0ad275eaaad09d8 Mon Sep 17 00:00:00 2001 From: "Acid Chicken (硫酸鶏)" Date: Sat, 20 May 2023 18:52:08 +0000 Subject: ci: fix head user --- .github/workflows/storybook.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to '.github/workflows') diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 19a03e5dea..6cb1b34997 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -86,7 +86,11 @@ jobs: if [ "$CHROMATIC_PARAMETER" = " --skip" ]; then echo "skip=true" >> $GITHUB_OUTPUT fi - pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name ${{ github.event.pull_request.head.ref }} $(echo "$CHROMATIC_PARAMETER") + BRANCH="${{ github.event.pull_request.head.user.login }}:${{ github.event.pull_request.head.ref }}" + if [ "$BRANCH" = "misskey-dev:${{ github.event.pull_request.head.ref }}" ]; then + BRANCH="${{ github.event.pull_request.head.ref }}" + fi + pnpm --filter frontend chromatic --exit-once-uploaded -d storybook-static --branch-name $BRANCH $(echo "$CHROMATIC_PARAMETER") env: CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} - name: Notify that Chromatic detects changes -- cgit v1.2.3-freya