Demo Puppeteer Github Action Script
This is a working example of using a github action workflow to instigate puppeteer.
1. Table of Contents
- 2.1. Files
- 2.2. package.json
- 2.3. puppeteer.js
- 2.4. .github/workflows/puppeteer.yml
- 2.5. Built With
2. About The Project
2.1. Files
- package.json
- puppeteer.js
- .github/workflows/puppeteer.yml
2.2. package.json
The key component of the package.json is that you include the puppeteer-core
dependency.
"dependencies": {
"puppeteer-core": "^5.4.1"
}
2.3. puppeteer.js
This is the script that will execute and run puppeteer. I've made this a little more verbose and included some try/catch blocks to demo better javascript structure.
There is one "class", called runner
, that has one publid method called: run
.
You can see at the bottom we execute the class with:
runner.run();
This in-turn, will call the publicRun
method in the class - which will step through the try/catch blocks.
2.4. .github/workflows/puppeteer.yml
The workflow action only has a manual workflow_dispatch
, so you'll have to go into the 'actions' tab on github and
manually run the action.
This repo demonstrates the usage of the github action "IORoot/action__puppeteer--media@master" which will run a docker container with an instance of puppeteer in it.
To use the action, it's a matter of running youre commands like so:
- name: Test Code
uses: IORoot/action__puppeteer--media@master
with:
args: npm install
2.5. Built With
This project was built with the following frameworks, technologies and software.
3. Usage
Github Actions.
4. Customising
None.
5. Troubleshooting
None.
6. Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
7. License
Distributed under the MIT License.
MIT License
Copyright (c) 2022 Andy Pearson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8. Contact
Author Link: https://github.com/IORoot
9. Changelog
- v1.0.0 - Initial Commit