Skip to content

This action adds the commit sha and date to a json file read from the current runner environment as an action

Notifications You must be signed in to change notification settings

hdmsantander/npm-commit-date-ifier-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NPM commit/date ifier action

This action uses NPM as an action to add the commit id and the date of the commit to an object parsed from a JSON file. Updating the original file.

The project is compiled using ncc.

ncc build index.js --license licenses.txt

Inputs

json

Required The name of the JSON file to load and update with the commit id and date.

Outputs

json

The same JSON file but updated with the commit id and the date.

Example of input - output

JSON file before

pet.json

{
  "pet": "dog"
}

JSON file after

pet.json

{
  "pet": "dog",
  "commitId": "3198698c96323bfcffb1524fe95eb60bf6966406",
  "date": "2020-11-17T16:37:14-06:00"
}

The output can be used from the same JSON file or as output from the step in the following steps within the same job:

- name: Echo output
  run: echo "The result of the JSON transformation was ${{ steps.transform-json.outputs.json }}"

Example usage of action

.github/workflows/main.yml

- name: Transform JSON
  id: transform-json
  uses: hdmsantander/npm-commit-date-ifier-action@v1.0
  with:
    json: ${{ env.workspace }} pet.json

About

This action adds the commit sha and date to a json file read from the current runner environment as an action

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published