All Projects → Jaid → action-sync-node-meta

Jaid / action-sync-node-meta

Licence: MIT License
GitHub Action that syncs package.json with the repository metadata.

Programming Languages

javascript
184084 projects - #8 most used programming language
Handlebars
879 projects

Projects that are alternatives of or similar to action-sync-node-meta

assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+460%)
Mutual labels:  utility, actions, action, github-actions, github-action
setup-jdk
(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK
Stars: ✭ 32 (+28%)
Mutual labels:  actions, action, github-actions, github-action
clojure-dependency-update-action
A simple GitHub Actions job to create Pull Requests for outdated dependencies in clojure projects
Stars: ✭ 37 (+48%)
Mutual labels:  actions, action, github-actions, github-action
recent-activity
Add your recent activity to your profile readme!
Stars: ✭ 87 (+248%)
Mutual labels:  actions, node-js, github-actions, github-action
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (+148%)
Mutual labels:  actions, action, github-actions, github-action
github-run-tests-action
mabl Github Actions implementation
Stars: ✭ 39 (+56%)
Mutual labels:  actions, action, github-actions, github-action
actions
Collection of repetitive GitHub Actions
Stars: ✭ 12 (-52%)
Mutual labels:  github-api, actions, action, github-actions
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+2832%)
Mutual labels:  actions, github-actions, github-action
dart-package-publisher
Action to Publish Dart / Flutter Package To https://pub.dev When you need to publish a package, just bump the version in pubspec.yaml
Stars: ✭ 45 (+80%)
Mutual labels:  actions, action, github-actions
action-netlify-deploy
🙌 Netlify deployments via GitHub actions
Stars: ✭ 32 (+28%)
Mutual labels:  actions, github-actions, github-action
clang-format-action
GitHub Action for clang-format checking
Stars: ✭ 48 (+92%)
Mutual labels:  actions, github-actions, github-action
rubocop-linter-action
Rubocop Linter Action: A GitHub Action to run Rubocop against your code!
Stars: ✭ 86 (+244%)
Mutual labels:  actions, action, github-actions
nrwl-nx-action
A GitHub Action to wrap Nrwl Nx commands in your workflows.
Stars: ✭ 163 (+552%)
Mutual labels:  actions, github-actions, github-action
action-autotag
Automatically generate a new tag when the manifest file (package.json, Dockerfile, custom file, etc) version changes.
Stars: ✭ 45 (+80%)
Mutual labels:  actions, action, github-actions
actions
Set of actions for implementing CI/CD with werf and GitHub Actions
Stars: ✭ 67 (+168%)
Mutual labels:  actions, action, github-actions
setup-bats
GitHub Action to setup BATS testing framework
Stars: ✭ 25 (+0%)
Mutual labels:  action, github-actions, github-action
hugo-action
Commands to help with building Hugo based static sites
Stars: ✭ 65 (+160%)
Mutual labels:  action, github-actions, github-action
action-homebrew-bump-formula
⚙️ A GitHub Action to easily bump Homebrew formula on new release
Stars: ✭ 68 (+172%)
Mutual labels:  actions, action, github-actions
qodana-action
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana
Stars: ✭ 112 (+348%)
Mutual labels:  actions, github-actions, github-action
jest-github-action
Jest action adding checks with annotations to your pull requests and coverage table as comments
Stars: ✭ 134 (+436%)
Mutual labels:  actions, action, github-actions

action-sync-node-meta

License Sponsor action-sync-node-meta
Build status Commits since v2.0.0 Last commit Issues

GitHub Action that syncs package.json with the repository metadata.

There are values that are meant to be the same. Why not automatically keep them synchronized?

Banner

Example output

Example output

Example

overwrite-file

Example workflow that runs whenever commits are pushed on branch master.
This will overwrite the package.json file if it differs from the GitHub repository info.

This is the recommended syncing direction, because of the more simple setup (no need to manually add a secret to the repository settings) and the advantages of git commits (better monitoring, revertability).

.github/workflows/example.yml

name: Sync package.json with repository info
on:
  push:
    branches: [master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: actions/checkout
        uses: actions/[email protected]
      - name: Jaid/action-sync-node-meta
        uses: jaid/[email protected]
        with:
          githubToken: ${{ secrets.GITHUB_TOKEN }}

overwrite-github

Example workflow that runs whenever commits are pushed on branch master.
This will change the GitHub repository info whenever it differs from the content of package.json.

The secret customGithubToken is forwarded to the input githubToken. It has to be a personal access token with scope "repo" added in your repository's secrets settings.

.github/workflows/example2.yml

name: Sync repository info with package.json
on:
  push:
    branches: [master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: actions/checkout
        uses: actions/[email protected]
      - name: Jaid/action-sync-node-meta
        uses: jaid/[email protected]
        with:
          direction: overwrite-github
          githubToken: ${{ secrets.customGithubToken }}
Detailed setup Go to your account settings and then to “Developer settings”.

Token setup: Step 1

Go to “Personal access tokens”.

Token setup: Step 2

Click “Generate new token”.

Token setup: Step 3

Give it a good title, so you still know what your token does in one year. Add „repo“ permissions.

Token setup: Step 4

Copy the generated token.

Token setup: Step 5

Go to the repository that uses action-sync-node-meta. Go to “Settings”, “Secrets”.

Token setup: Step 6

Click “New repository secret”.

Token setup: Step 7

Add the secret token from your clipboard. Name the token “repoGithubToken” or anything you like.

Token setup: Step 8

Now pass the token to action-sync-node-meta in your workflow file.

- name: Jaid/action-sync-node-meta
  uses: jaid/[email protected]
  with:
    direction: overwrite-github
    githubToken: ${{ secrets.repoGithubToken }}

Options

Default Info
githubToken * Repository token for allowing the action to make commits or change the repository info. If direction is "overwrite-file", this input be set from forwarding secrets.GITHUB_TOKEN in the workflow file. If direction is "overwrite-github", a custom personal access token with "repo" scope has to be created.
approve true If true and direction is "overwrite-file", pull requests created by this action are automatically approved and merged.
branch action-sync-node-meta The name of the branch to make changes on (only for direction "overwrite-file"). Substring “{random}” will be replaced with randomized characters.
commitMessage autofix: Updated package.json[{changes}] Commit message for package.json changes (only for direction "overwrite-file"). Substring “{changes}” will be replaced with a list of changed package.json fields.
direction overwrite-file The syncing direction, can be "overwrite-file" or "overwrite-github". If "overwrite-file", the file package.json will be edited in a pull request according to the GitHub repository info. If "overwrite-github", the GitHub repository info will be changed according to the content of the package.json file.
jsonFinalNewline true If true and direction is "overwrite-file", the updated package.json will have a final newline.
removeBranch true If true and direction is "overwrite-file" and approve is also true, automatically merged pull requests will delete their branch afterwards.
syncDescription true If true, package.json[description] will be synced with GitHub repository description.
syncHomepage true If true, package.json[homepage] will be synced with GitHub repository homepage.
syncKeywords true If true, package.json[keywords] will be synced with GitHub repository topics.

Development

Setting up:

git clone [email protected]:jaid/action-sync-node-meta.git
cd action-sync-node-meta
npm install

License

MIT License
Copyright © 2021, Jaid <[email protected]> (https://github.com/jaid)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].