npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

links-updater

v1.0.5

Published

GitHub Action to update repository links

Downloads

310

Readme

LinkApp Action

A GitHub Action to automatically update links across your repository files. Perfect for maintaining documentation, updating deprecated URLs, or managing repository-wide link changes.

Features

  • 🔄 Automatically updates URLs across multiple files and directories
  • ⚙️ Configurable through YAML file
  • 📁 Supports multiple file types (md, html, etc.)
  • 🎯 Selective path processing
  • ⛔ Link ignore list support
  • 🔑 Template and environment variable support
  • 📝 Detailed logging and error reporting

Quick Start

  1. Create a configuration file .github/updatelinks.yml:
paths:
  - 'docs'
  - 'src'
  - '.'
files:
  - 'md'
  - 'html'
links:
  - old: 'https://old-url.com'
    new: 'https://new-url.com'
ignore:
  - 'https://dont-change-this.com'
  1. Create a workflow file .github/workflows/linkapp.yml:
name: Update Repository Links
on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  update-links:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: vixshan/[email protected]
        with:
          token: ${{ secrets.GH_TOKEN }}

Configuration Options

Configuration File Structure

The configuration file (default: .github/updatelinks.yml) supports the following options:

# Directories to process
paths:
  - 'docs'
  - 'src'
  - '.'

# File types to process
files:
  - '*.md'
  - '*.txt'
  - 'CHANGELOG'
  - 'README.md'

# Regular link/keyword mappings (for non-GitHub URLs)
links:
  - old: 'https://discord.gg/oldlink'
    new: 'https://discord.gg/newlink'
  - old: 'https://example.com/docs'
    new: ${{ secrets.NEW_DOCS_URL }}
    links:
  - old: 'oldkeyword'
    new: 'newkeyword'

# Links/files to ignore during processing
ignore:
  - 'https://github.com/special-repo'
  - 'https://keep-this-link.com'

  - 'node_modules'
  - '*.test.js'
  - 'temp.txt'

Action Inputs

| Input | Required | Default | Description | | ------------- | -------- | ------------------------- | ---------------------------------- | | token | Yes | N/A | GitHub token for repository access | | config-path | No | .github/updatelinks.yml | Path to configuration file |

Advanced Usage

Using GitHub Context Variables

You can use GitHub context variables in your configuration:

links:
  - old: 'https://github.com/old/repo'
    new: ${{ github.repository }}
  - old: 'https://example.com/docs'
    new: ${{ secrets.NEW_DOCS_URL }}

# Automatic GitHub URL processing
githubUrls:
  types:
    - 'username' # Will update any github.com/username references and only those, not the repo or sponsors
    - 'repo' # Will update any github.com/username/repo references
    - 'sponsors' # Will update any github.com/sponsors/username references
    # - 'all'     # Uncomment to update all GitHub URLs

Multiple File Type Processing

Process different file types with specific patterns:

files:
  - 'md'
  - 'mdx'
  - 'html'
  - 'rst'
  - 'txt'

Selective Path Processing

Choose specific directories or files to process:

paths:
  - 'docs' # Process entire docs directory
  - 'src/components' # Process specific subdirectory
  - 'README.md' # Process specific file

Whether to Create a Pull Request

By default, the action will update the files in the repository directly. If you want to create a pull request instead, you can use the following configuration:

createPr: true

Installation

Option 1: Using the Action from the Marketplace

  1. Create the configuration file .github/updatelinks.yml
  2. Create the workflow file .github/workflows/linkapp.yml
  3. Configure the workflow to use this action
  4. Commit and push the changes

Option 2: Building and Publishing Your Own Version

  1. Clone this repository
  2. Install dependencies:
    bun install
  3. Make your modifications
  4. Build the action:
    bun run build
  5. Commit all changes, including the dist folder
  6. Create a new release with a tag (e.g., v1)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any problems or have questions, please open an issue in the repository.

Security

This action requires a GH_TOKEN with write permissions to update repository files. The token is automatically provided by GitHub Actions but needs to be explicitly passed to the action.

For security best practices:

  • Only grant the minimum required permissions
  • Be careful when using custom configuration files
  • Review the link replacement patterns before deployment

Acknowledgments

This action was inspired by the need to maintain consistent documentation and links across repositories. You can say i am lazy but after forking repositories, i have to update the links in the README.md file and i thought why not automate this process. So here it is.

Alt