Skip to content

Block client-side `git push` to `INPUT_GIT_PROTECTED_BRANCHES` listed branches on Friday or weekend days

License

Notifications You must be signed in to change notification settings

gha-utilities/weekend-push-guardian

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Weekend Push Guardian

Block client-side git push to INPUT_GIT_PROTECTED_BRANCHES listed branches on Friday or weekend days

Byte size of Weekend Push Guardian Open Issues Open Pull Requests Latest commits License



Requirements

NodeJS dependencies may be installed via NPM...

npm install

Quick Start

Usage

Reference the code of this repository within your own workflow...

name: Weekend Push Guardian

on:
  push:


jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source branch for building Pages
        uses: actions/checkout@v4
        with:
          fetch-depth: 10

      - name: Weekend Push Guardian
        id: weekend-push-guardian
        uses: gha-utilities/[email protected]
        with:
          git_protected_branches: 'main,master'

      - name: Enjoy your weekend
        if: steps.weekend-push-guardian.outputs.passed != 'true'
        run: |
          echo "Go touch grass!"

      - name: Get stuff done on weekdays
        if: steps.weekend-push-guardian.outputs.passed && success()
        run: |
          echo "Do things on weekdays"

Notes

This repository may not be feature complete and/or fully functional, Pull Requests that add features or fix bugs are certainly welcomed.


Git Hooks

For that want to mitigate pushing to GitHub on Friday or weekend days in the first place, this repository also provides Git Hooks written in pure Bash script for client, and private server(s)! Simply clone this repository and consult the official Git documentation for how to use;

  • hooks/pre-push documentation: man --pager='less --pattern="^\s+pre-push"' githooks
  • hooks/pre-receive documentation: man --pager='less --pattern="^\s+pre-receive"' githooks

Contributing

Options for contributing to weekend-push-guardian and gha-utilities


Forking

Start making a Fork of this repository to an account that you have write permissions for.

cd ~/git/hub/gha-utilities/weekend-push-guardian

git remote add fork [email protected]:<NAME>/weekend-push-guardian.git
  • Commit your changes and push to your fork, eg. to fix an issue...
cd ~/git/hub/gha-utilities/weekend-push-guardian


git commit -F- <<'EOF'
:bug: Fixes #42 Issue


**Edits**


- `<SCRIPT-NAME>` script, fixes some bug reported in issue
EOF


git push fork main

Note, the -u option may be used to set fork as the default remote, eg. git push -u fork main however, this will also default the fork remote for pulling from too! Meaning that pulling updates from origin must be done explicitly, eg. git pull origin main

  • Then on GitHub submit a Pull Request through the Web-UI, the URL syntax is https://github.com/<NAME>/<REPO>/pull/new/<BRANCH>

Note; to decrease the chances of your Pull Request needing modifications before being accepted, please check the dot-github repository for detailed contributing guidelines.


Sponsor

Thanks for even considering it!

Via Liberapay you may sponsor__shields_io__liberapay on a repeating basis.

Regardless of if you're able to financially support projects such as weekend-push-guardian that gha-utilities maintains, please consider sharing projects that are useful with others, because one of the goals of maintaining Open Source repositories is to provide value to the community.


Attribution


License

Block client-side `git push` to `INPUT_GIT_PROTECTED_BRANCHES` listed branches on Friday or weekend days
Copyright (C) 2024 S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

For further details review full length version of AGPL-3.0 License.

About

Block client-side `git push` to `INPUT_GIT_PROTECTED_BRANCHES` listed branches on Friday or weekend days

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published