Skip to content

Commit

Permalink
Use changes files to detect if changeset file is present (#4298)
Browse files Browse the repository at this point in the history
* Update changeset status action

* Update changeset status action

* Use gh cli

* Organise envs

* Add quotes
  • Loading branch information
andrzejewsky authored Oct 12, 2023
1 parent 7329f2c commit ad9fd12
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-bulldogs-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Use changes files to detect if changeset file is present
30 changes: 18 additions & 12 deletions .github/workflows/changesets-status.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
name: Changesets

on: [pull_request]

jobs:
status:
changeset_present:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Check changesets status
run: npx @changesets/cli@2.26.2 status --since origin/main

- 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
- name: Changeset file lookup
env:
GH_TOKEN: ${{ github.token }}
PR_BRANCH: ${{ steps.extract_branch.outputs.branch }}
run: |
files=$(gh pr diff "$PR_BRANCH" --name-only)
if [[ $files =~ \.changeset\/.*.md ]]; then
echo "Changesets found!"
else
echo "There is no changeset file in your pull request."
exit 1
fi

0 comments on commit ad9fd12

Please sign in to comment.