first commit #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################### | |
# UPDATE REPO INFO | |
############################################################################### | |
name: ✅ Update repo info | |
############################################################################### | |
# ON | |
############################################################################### | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'package.json' | |
workflow_dispatch: | |
############################################################################### | |
# JOBS | |
############################################################################### | |
jobs: | |
build: | |
name: Update repo info | |
runs-on: ubuntu-latest | |
########################################################################### | |
# STEPS | |
########################################################################### | |
steps: | |
######################################################################### | |
# INIT REPO | |
######################################################################### | |
- name: 🛎 Checkout | |
uses: actions/checkout@v3 | |
######################################################################### | |
# UPDATE | |
######################################################################### | |
- name: Change GitHub data | |
run: | | |
repo_url=$(echo $(jq -r . ./package.json) | jq -r '.repository.url') | |
description=$(echo $(jq -r . ./package.json) | jq -r '.description') | |
homepage=$(echo $(jq -r . ./package.json) | jq -r '.homepage') | |
keywords=$(echo $(jq -r . ./package.json) | jq -r '.keywords | join(",")') | |
if [[ -n $repo_url ]]; then | |
gh repo edit "$repo_url" -d "$description" | |
fi | |
if [[ -n e ]]; then | |
gh repo edit "$repo_url" --add-topic "$keywords" | |
fi | |
if [[ -n $homepage ]]; then | |
gh repo edit "$repo_url" --homepage "$homepage" | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GH_API_TOKEN }} # changed github.token needs permissions | |
############################################################################### |