Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

malomehi/link-checks-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

Link checks action

The Link Checks Action is a GitHub Action that checks if the links provided in a file are valid. It ensures that the links return a 200 response code and do not return an error. This is a safety net to ensure that URLs are not shipped broken due to mistakes that may occur during copy-pasting or refactoring.

Hot to use

To use this action, add it to your YML file and specify the file or files you want to check.

- name: Run URL check script
  uses: adriancoman/[email protected]
  with:
    file-to-check: "{path_to_your_file}"

You can add multiple files as well, if they are comma separated:

- name: Run URL check script
  uses: adriancoman/[email protected]
  with:
    file-to-check: "{path_to_1st_file},{path_to_2nd_file},{path_to_3rd_file}"

Use cases

This action is particularly useful for mobile apps that hold external links in a file with constant values. For example:

object UrlConstants {
    const val TERMS = "https://www.my_awesome_website.com/terms.html"
    const val PRIVACY = "https://www.my_awesome_website.com/privacy.html"
}

By using the Link Checks Action, you can be notified if a URL is broken.

Contribution

There are a lot of improvements that can be added, from the top of my head:

  • Check only modified files
  • Accept a list of params, instead of a single file
  • Change the http response code to be valid in the intervel [200..300)

However, for now, it is a simple script that works and does its job.

Full working example

The YAL file bellow is a working example of how to use the Link Checks Action in your workflow.

on:
  pull_request:
    branches:
      - '**'

jobs:
  check_urls:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Link check action
        uses: adriancoman/[email protected]
        with:
          file-to-check: "components/src/main/java/app/components/ui/misc/terms/UrlConstants.kt"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%