Star My Repo #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Star My Repo | |
on: | |
workflow_dispatch: | |
watch: | |
types: | |
- started | |
jobs: | |
change-the-bulb-color: | |
name: Change the Demo Bulb Color | |
runs-on: ubuntu-latest | |
steps: | |
- name: Find Random Color | |
id: find-random-color | |
run: | | |
RN=$(( $RANDOM % 9 + 1 )) | |
case $RN in | |
1) | |
COLOR="white" | |
;; | |
2) | |
COLOR="red" | |
;; | |
3) | |
COLOR="orange" | |
;; | |
4) | |
COLOR="yellow" | |
;; | |
5) | |
COLOR="cyan" | |
;; | |
6) | |
COLOR="green" | |
;; | |
7) | |
COLOR="blue" | |
;; | |
8) | |
COLOR="purple" | |
;; | |
9) | |
COLOR="pink" | |
;; | |
*) | |
COLOR="THIS IS BAD" | |
;; | |
esac | |
echo $RN | |
echo $COLOR | |
# echo "::set-output name=bulbcolor::$COLOR" | |
echo "bulbcolor=$COLOR" >> $GITHUB_OUTPUT | |
- name: Output var | |
run: echo ${{ steps.find-random-color.outputs.bulbcolor }} | |
- name: Change the bulb color | |
run: | | |
curl --fail-with-body -X PUT "https://api.lifx.com/v1/lights/${{ vars.LIFX_BULB_LOCATION }}/state" -H "Authorization: Bearer ${{secrets.LIFX_TOKEN}}" -H "Content-Type: application/x-www-form-urlencoded" -d "color=${{ steps.find-random-color.outputs.bulbcolor }}" |