-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use changes files to detect if changeset file is present (#4298)
* Update changeset status action * Update changeset status action * Use gh cli * Organise envs * Add quotes
- Loading branch information
1 parent
7329f2c
commit ad9fd12
Showing
2 changed files
with
23 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |