|
| 1 | +name: Poutine Level 0 |
| 2 | +on: |
| 3 | + issues: |
| 4 | + types: [opened, edited] |
| 5 | + issue_comment: |
| 6 | + types: [created, edited] |
| 7 | + pull_request_target: |
| 8 | + types: [opened, synchronize] |
| 9 | + branches: |
| 10 | + - main |
| 11 | + pull_request: |
| 12 | + types: [closed] |
| 13 | + branches: |
| 14 | + - main |
| 15 | + |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }} |
| 20 | + cancel-in-progress: false |
| 21 | + |
| 22 | +jobs: |
| 23 | + fries: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + timeout-minutes: 1 |
| 26 | + if: github.event_name == 'issues' |
| 27 | + permissions: |
| 28 | + id-token: write |
| 29 | + env: |
| 30 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + FLAG_GRAVY_OVERFLOW_L0_FRIES: ${{ secrets.FLAG_GRAVY_OVERFLOW_L0_FRIES }} |
| 32 | + steps: |
| 33 | + - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 |
| 34 | + with: |
| 35 | + egress-policy: audit |
| 36 | + - name: Check for profanities in issue body |
| 37 | + id: check_profanities |
| 38 | + run: | |
| 39 | + echo "Checking issue body for profanities..." |
| 40 | + PROFANITIES_LIST="bad|disguting|horrible" |
| 41 | + if echo "${{ github.event.issue.body }}" | grep -qiE "$PROFANITIES_LIST"; then |
| 42 | + echo "Profanity detected in issue body. Please clean up the language." |
| 43 | + exit 1 |
| 44 | + else |
| 45 | + echo "No profanities found in issue body." |
| 46 | + exit 0 |
| 47 | + fi |
| 48 | +
|
| 49 | + cheddar: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 1 |
| 52 | + if: github.event_name == 'issue_comment' |
| 53 | + permissions: |
| 54 | + id-token: write |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + FLAG_GRAVY_OVERFLOW_L0_CHEDDAR: ${{ secrets.FLAG_GRAVY_OVERFLOW_L0_CHEDDAR }} |
| 58 | + steps: |
| 59 | + - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 |
| 60 | + with: |
| 61 | + egress-policy: audit |
| 62 | + - name: Mini Chat Bot |
| 63 | + uses: actions/github-script@v5 |
| 64 | + with: |
| 65 | + script: | |
| 66 | + const commentBody = "${{ github.event.comment.body }}"; |
| 67 | + let response; |
| 68 | + if (commentBody.includes("hello")) { |
| 69 | + response = "Hello! How can I help you today?"; |
| 70 | + } else if (commentBody.includes("help")) { |
| 71 | + response = "Sure, what do you need help with?"; |
| 72 | + } else { |
| 73 | + response = "Sorry, I didn't understand that. Can you try again?"; |
| 74 | + } |
| 75 | +
|
| 76 | + github.rest.issues.createComment({ |
| 77 | + issue_number: context.payload.issue.number, |
| 78 | + owner: context.repo.owner, |
| 79 | + repo: context.repo.repo, |
| 80 | + body: response |
| 81 | + }); |
| 82 | +
|
| 83 | + gravy: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + timeout-minutes: 1 |
| 86 | + if: github.event_name == 'pull_request_target' |
| 87 | + permissions: |
| 88 | + id-token: write |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 91 | + FLAG_GRAVY_OVERFLOW_L0_GRAVY: ${{ secrets.FLAG_GRAVY_OVERFLOW_L0_GRAVY }} |
| 92 | + steps: |
| 93 | + - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 |
| 94 | + with: |
| 95 | + egress-policy: audit |
| 96 | + - name: Checkout PR code |
| 97 | + uses: actions/checkout@v4 |
| 98 | + with: |
| 99 | + ref: ${{ github.event.pull_request.head.sha }} |
| 100 | + - name: Setup Node.js |
| 101 | + uses: actions/setup-node@v4 |
| 102 | + with: |
| 103 | + node-version: 21 |
| 104 | + - run: | |
| 105 | + npm install |
| 106 | + npm run lint |
| 107 | + npm start |
| 108 | +
|
| 109 | + toppings: |
| 110 | + runs-on: ubuntu-latest |
| 111 | + timeout-minutes: 1 |
| 112 | + if: github.event_name == 'pull_request' |
| 113 | + permissions: |
| 114 | + id-token: write |
| 115 | + env: |
| 116 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 117 | + FLAG_GRAVY_OVERFLOW_L0_TOPPINGS: ${{ secrets.FLAG_GRAVY_OVERFLOW_L0_TOPPINGS }} |
| 118 | + steps: |
| 119 | + - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 |
| 120 | + with: |
| 121 | + egress-policy: audit |
| 122 | + - name: Checkout PR code |
| 123 | + uses: actions/checkout@v4 |
| 124 | + with: |
| 125 | + ref: ${{ github.event.pull_request.head.sha }} |
| 126 | + - name: Setup Node.js |
| 127 | + uses: actions/setup-node@v4 |
| 128 | + with: |
| 129 | + node-version: 21 |
| 130 | + - run: | |
| 131 | + npm install |
| 132 | + npm run lint |
0 commit comments