Skip to content

Issues 36 38

Issues 36 38 #42

Workflow file for this run

on:
push:
branches:
main
pull_request:
branches:
main
permissions:
contents: write
name: Generate Lockfile
jobs:
generate-lock-file:
runs-on: ubuntu-latest
steps:
- name: Get the branch name
id: get-branch-name
run: echo ::set-output name=BRANCH_NAME::${{ github.head_ref }}
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ steps.get-branch-name.outputs.BRANCH_NAME }}
- name: Install Node
uses: actions/setup-node@v4
- name: Generate Lock File
run: npm i --package-lock-only
- name: Check for changes
id: check-changes
run: echo ::set-output name=lockfile_changed::$(if git diff --exit-code --quiet; then echo "false"; else echo "true"; fi)
- name: Push Lock File
run: |
if [[ "${{ steps.check-changes.outputs.lockfile_changed }}" == "true" ]]; then
git config --global user.name 'fahad-githubaction'
git config --global user.email 'fahadfaruqi1@gmail.com'
git add .
git commit -am "adding lockfile"
git push origin ${{ steps.get-branch-name.outputs.BRANCH_NAME }}
fi