Skip to content

Release: 1.3.1

Release: 1.3.1 #15

Workflow file for this run

name: Overwrite GitHub repo metadata with info from package.json
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
name: Sync Metadata
runs-on: ubuntu-latest
env:
IS_VALID_TOKEN: false
HAS_PACKAGE: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for package.json
run: |
if [ -f package.json ]; then
echo "📦 Found package.json"
echo "HAS_PACKAGE=true" >> $GITHUB_ENV
else
echo "❌ This action requires a package.json to run"
echo "HAS_PACKAGE=false" >> $GITHUB_ENV
fi
- name: Validate Access Token
if: env.HAS_PACKAGE == 'true'
run: |
if [ -z ${{ secrets.PERSONAL_ACCESS_TOKEN }} ]; then
echo "❌ This action requires a Personal Access token to run"
echo "IS_VALID_TOKEN=false" >> $GITHUB_ENV
else
echo "🔑 Authenticated with Personal Access token"
echo "IS_VALID_TOKEN=true" >> $GITHUB_ENV
fi
- name: Sync Package info to GitHub
if: env.IS_VALID_TOKEN == 'true' && env.HAS_PACKAGE == 'true'
uses: kitschpatrol/github-action-repo-sync@v2
with:
TYPE: npm
PATH: package.json
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}