Skip to content

Commit

Permalink
Fix changeset action for forks, block automation on contributions (#4420
Browse files Browse the repository at this point in the history
)

* Update changesets, block automation on fork

* Update changesets, block automation on fork

* Add prefix for env names

* trigger

* Remove env
  • Loading branch information
andrzejewsky authored Nov 13, 2023
1 parent e9cde3a commit 3d28c98
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-ties-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Fix changeset action for forks, block automation on contributions
14 changes: 6 additions & 8 deletions .github/workflows/changesets-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Extract branch name
id: extract_branch
run: |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
uses: actions/checkout@v4
with:
sparse-checkout: ./.changeset

- name: Changeset file lookup
env:
GH_TOKEN: ${{ github.token }}
PR_BRANCH: ${{ steps.extract_branch.outputs.branch }}
PR_ID: ${{ github.event.number }}
run: |
files=$(gh pr diff "$PR_BRANCH" --name-only)
files=$(gh pr diff "$PR_ID" --name-only)
if [[ $files =~ \.changeset\/.*.md ]]; then
echo "Changesets found!"
else
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/pr-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ concurrency:
jobs:
prepare_variables:
runs-on: ubuntu-22.04
if: github.event.pull_request.head.repo.full_name == 'saleor/saleor-dashboard'
outputs:
POOL_NAME: ${{ steps.generate.outputs.POOL_NAME }}
POOL_INSTANCE: ${{ steps.generate.outputs.POOL_INSTANCE }}
Expand All @@ -28,11 +29,13 @@ jobs:

- name: Generate
id: generate
env:
PREFIX: pr-
run: |
echo "BASE_URL=${GITHUB_HEAD_REF_SLUG_URL}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT
echo "API_URI=https://${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
echo "POOL_NAME=${GITHUB_HEAD_REF_SLUG_URL}" >> $GITHUB_OUTPUT
echo "POOL_INSTANCE=https://${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud" >> $GITHUB_OUTPUT
echo "BASE_URL=${PREFIX}${GITHUB_HEAD_REF_SLUG_URL}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT
echo "API_URI=https://${PREFIX}${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud/graphql/" >> $GITHUB_OUTPUT
echo "POOL_NAME=${PREFIX}${GITHUB_HEAD_REF_SLUG_URL}" >> $GITHUB_OUTPUT
echo "POOL_INSTANCE=https://${PREFIX}${GITHUB_HEAD_REF_SLUG_URL}.staging.saleor.cloud" >> $GITHUB_OUTPUT
- name: Saleor login
uses: ./.github/actions/cli-login
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
- name: Remove instance
env:
SALEOR_CLI_ENV: staging
run: npx saleor env remove "$GITHUB_HEAD_REF_SLUG_URL" --force
run: npx saleor env remove "pr-${GITHUB_HEAD_REF_SLUG_URL}" --force

0 comments on commit 3d28c98

Please sign in to comment.