DEV Community

loading...

Control the Probability of This GitHub Action from Passing/Failing

hedyli profile image Hedy Li ・1 min read

Just give it a percentage, say 50, and it will have a 50/50 chance of passing! Which means if you give it 0 or 10, it will fail all the time and most of the times respectively. 😏 Pretty cool right?

GitHub repo

GitHub logo hedythedev / passibility

βœ… Control the probability of this Github action from passing/failing!

How to use this

name: "Will I Pass..."
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: hedythedev/passibility@main
        with:
          percentage: 100

Example Workflow: This workflow will pass all the time!

Option Inputs

percentage

Percentage of passing - (without the %) 0, for always fail, 100 for always pass and so on.

Additional info

  • This is my first GitHub action, and it’s written in JavaScript.
  • Generated from the JavaScript Action Template
  • Unit tests using Jest
  • This isn’t a submission to the Actions Hackathon because I’m not old enough (18+ only), but I made this to experiment with GitHub Actions
  • Feel free to try it out and give me some feedback
  • Contributions welcome - like having another input called fail_percentage so you can instead provide the fail probability? πŸ€”
  • Remember to ⭐ star the project if you liked it ;)

Discussion

pic
Editor guide