Giter Site home page Giter Site logo

takanuva15 / verify-file-updated Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26 KB

GitHub action to verify that the changelog file has been updated in a PR

License: GNU General Public License v3.0

Shell 100.00%
github-actions changelog verify verification check

verify-file-updated's Introduction

verify-file-updated GitHub Action

This started out as a simple GitHub Action to check whether the changelog file had been updated in PR builds since, if you're anything like me, you may have merged a PR or two while completely forgetting to update the changelog. Since this action's code is pretty generic though, it can apply to any file in your repo such as the README or CONTRIBUTING file - thus I updated this action to reflect the fact that you can check for any file.

Getting Started

Assuming you have a file named CHANGELOG.md within the root of your repository, add the following to a new file .github\workflows\verify_pr.yml:

name: Run PR Checks
on:
  pull_request:
    branches:
    - main

jobs:
  check_changelog:
    runs-on: ubuntu-latest
    name: Verify Changelog Updated
    steps:
    - name: Verify Changelog Updated
      uses: takanuva15/verify-file-updated@v1

Commit the file and create a PR to main - you should see the action run.

Additional Usage Parameters

There are three additional parameters you can specify for the GitHub action:

  • excused_label: A label that, when added to the PR, will exempt the PR from needing to satisfy this check.
    • Default is changelog update optional
  • filename_to_check: The name of the file to check. The GitHub Action will verify whether this file has been updated within the PR.
    • Default is CHANGELOG.md
  • token: The authentication token to use for accessing the PR's information. A token is required in order to view the files changed in a PR.
    • Default is "${{ github.token }}"

(Both parameters are case-sensitive)

Sample usage:

steps:
  - name: Verify Readme Updated
    uses: takanuva15/verify-file-updated@v1
    with:
      excused_label: readme update optional
      filename_to_check: README.md
      token: ${{ secrets.MY_TOKEN }}

Notes

If you add a label after a PR has already been created, you will need to trigger a fresh build by pushing (or force-pushing) a commit. (This is due to GitHub caching the PR data when the PR is created, so a commit is required in order to refresh the cache)

Contributing

We are happy to take contributions. If you experience an issue or see something that can be improved, feel free to raise an issue. Assuming that there is agreement on the issue, fork the repo and raise a PR to make your change.

If you like this action, feel free to star/watch the repo to show your support!

Credits

  • Credit to Zomzog/changelog-checker as the inspiration for this GitHub action.
  • Credit to various stackoverflow questions for answering my queries regarding bash & jq. (Links are provided in the bash script's comments)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.