-
-
Notifications
You must be signed in to change notification settings - Fork 285
dist/
content validation
#2483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
dist/
content validation
#2483
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: package-check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
package-check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/[email protected] | ||
with: | ||
cache: 'yarn' | ||
node-version: '20.x' | ||
|
||
- name: install dependencies | ||
run: yarn install | ||
|
||
- name: rebuild the dist/ directory | ||
run: yarn build && yarn package | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if something like it ?
Anchore uses this approach in their Actions https://github.com/anchore/scan-action/blob/main/.github/workflows/test.yml#L18-L23 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep that could work as well. I'm pretty much going to leave this PR here "as-is" since it works and this is an implementation I have personally used in the past and it comes right from GitHub's own public template on building Actions. If the maintainers want to adopt it, tweak it, or make modifications that is totally fine and I would expect them to do so. The extra reasons why I chose this approach was:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good! |
||
|
||
- name: compare the expected and actual dist/ directories | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after build. See status below:" | ||
git diff | ||
exit 1 | ||
fi | ||
id: diff | ||
|
||
# If index.js was different than expected, upload the expected version as an artifact | ||
- uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # [email protected] | ||
if: ${{ failure() && steps.diff.conclusion == 'failure' }} | ||
with: | ||
name: dist | ||
path: dist/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're pinning
actions/upload-artifact
, should we pin this as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, v4.3.0 is the latest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joshmgross I was going to but rather chose to keep it the same as all other references in this project for now:
changed-files/.github/workflows/test.yml
Lines 47 to 51 in 0fee5fb
A pretty good follow-up PR to this one would be going through all 3rd party workflows in this project and pinning them to exact commit SHAs IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maintainer seems to have pinned all other actions, I'd suggest pinning here as well.