github-javascript-action v2.0.0
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.
const {exec} = require('child_process');
const core = require('@actions/core');
async function commit() {
core.info('git commit');
exec('git config --global user.email "username@mail.com"');
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
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
name: JavaScript CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.3
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
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago