aboutsummaryrefslogtreecommitdiff
path: root/entries/nickbradley/.github/workflows/fib.yml
blob: 860ee2203b70253af66ea39b9dcf01e31b6bf89c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: fib\
on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

  workflow_dispatch:

jobs:
  compute:
    runs-on: ubuntu-latest  
    steps:
     - name: sum
       env:
         GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
       shell: bash
       run: |
        prev_fib=${{ secrets.PREV_FIB_NUM }}
        curr_fib=${{ secrets.CURR_FIB_NUM }}
        next_fib=$((${prev_fib:-0} + ${curr_fib:-1}))
        echo "prev=$curr_fib" >> $GITHUB_ENV
        echo "curr=$next_fib" >> $GITHUB_ENV
     - uses: gliech/create-github-secret-action@v1
       with:
         name: PREV_FIB_NUM
         value: ${{ env.prev }}
         pa_token: ${{ secrets.GH_TOKEN }}
     - uses: gliech/create-github-secret-action@v1
       with:
         name: CURR_FIB_NUM
         value: ${{ env.curr }}
         pa_token: ${{ secrets.GH_TOKEN }}
     - name: Create commit comment
       uses: peter-evans/commit-comment@v2
       with:
          body: |
            Your Fibonacci number is ${{ env.curr }}.