Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gayanvoice/javascript-action
JavaScript Action makes it easy to commit all your changes to repository with CI/CD.
https://github.com/gayanvoice/javascript-action
fs-extra github-actions javascript javascript-action simple-git
Last synced: about 1 month ago
JSON representation
JavaScript Action makes it easy to commit all your changes to repository with CI/CD.
- Host: GitHub
- URL: https://github.com/gayanvoice/javascript-action
- Owner: gayanvoice
- License: mit
- Created: 2021-05-09T03:28:17.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-30T12:52:50.000Z (about 2 years ago)
- Last Synced: 2024-05-29T17:13:34.097Z (7 months ago)
- Topics: fs-extra, github-actions, javascript, javascript-action, simple-git
- Language: JavaScript
- Homepage: https://github.com/gayanvoice/javascript-action-template
- Size: 782 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript Action | File Handling and GitHub Operations
Use this repository to bootstrap the creation of a JavaScript action for file handling and Git operations.
This repository includes create directory, create Json file, read Json file, git commit and git push.
## Create an action from this repository
### 1. Folk the repository
### 2. Change the git.js
Go to src/git/git.js and
change
user.email with your GitHub account's primary email
and
user.name with your GitHub profile name.```javascript
const {exec} = require('child_process');
const core = require('@actions/core');async function commit() {
core.info('git commit');
exec('git config --global user.email "[email protected]"');
exec('git config --global user.name "GitHub Name"');
exec('git add .');
exec('git commit -m "message"');
}module.exports = commit
```### 3. Package for distribution
Run prepare
```bash
npm run prepare
```### 4. Push changes to repository
## Create a workflow
### 1. Create an empty repository or go to an existing repository
### 2. Create YML file in .github/workflows/main.yml and change to your JavaScript Action repository url
```yml
name: JavaScript CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: JavaScript Action
uses: gayanvoice/javascript-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SECRETS_CONTEXT: ${{ toJson(secrets) }}
```
### 3. Go to Actions to see the process