Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Package action and do not checkin node_modules in any branch #5

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

Merged
merged 3 commits into from
Oct 23, 2019

Conversation

bryanmacfarlane
Copy link
Member

@bryanmacfarlane bryanmacfarlane commented Oct 23, 2019

Checking in node_modules causes many problems even if it's in a distribution branch. There's no way to ignore just dev dependencies and it's painful to work in master and merge down but keep two different working models between the branches.

ncc has solved this and also works with typescript (even though this template is just js)

```

```bash
$ npm prune --production
$ git add node_modules
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
```

Your action is now published! :rocket:

See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized this versioning doc needs to get rewritten in light of this. Will do that next and update this link.

@bryanmacfarlane
Copy link
Member Author

thanks @joshmgross

will iterate with more changes as we get more feedback.

Copy link
Contributor

@JasonEtco JasonEtco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me - a nice, simple addition 🙌 The only suggestion I'd make is that further explanation of the reason this is necessary wouldn't hurt. Something like:

To run your code, GitHub Actions needs all your dependencies' code to be available. This packaging script compiles the code into one file that can be checked in to Git, enabling fast execution and preventing the need to check in node_modules.

Can certainly be left for another PR if you're looking to 🚢 this!

@bryanmacfarlane bryanmacfarlane merged commit d080a47 into master Oct 23, 2019
@thboop
Copy link
Collaborator

thboop commented Oct 23, 2019

We likely want to update the default workflow
https://github.com/actions/javascript-action/blob/master/.github/workflows/test.yml#L7

We point the releases/* branches which is no longer a format we follow for releases. It may actually be hard to detect release branches, because v* would detect anything starting with a v. Something like v[0-9][0-9] might work. I was hoping v[0-9]+ would be an option, but you may need to check that its valid in fnmatch

We almost may want to look into a step in that workflow that ensures there are no unstaged changes after npm run package is run, that prevents a user from making changes to the source files and not generating the corresponding dist changes, or a malicious user trying to sneak something into the dist file when reviewers think it was auto generated.
git diff-index --quiet HEAD -- should work
https://stackoverflow.com/questions/3878624/how-do-i-programmatically-determine-if-there-are-uncommitted-changes

@bryanmacfarlane
Copy link
Member Author

#7 for @JasonEtco suggestion. Will make this improvement in next PR

@bryanmacfarlane
Copy link
Member Author

@thboop - good catch. I left that because this just has master but also because I opened #6 ... I got feedback from @jeffmcaffer and I want to close on that and update the toolkit versioning doc. He had the same instinct about the question I asked today about it being a little nerve wracking to merge and it's live (as opposed to merge, validate and then explicitly go live with tag). hmmm

@bryanmacfarlane bryanmacfarlane deleted the pkgaction branch October 23, 2019 02:53
Skitionek referenced this pull request in Skitionek/notify-microsoft-teams Apr 23, 2020
Change actions trigger from push to pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants