usage with github actions:
jobs:
InformDeploy:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Notify slack
run: |
nix eval --option build-use-sandbox false --json --impure \
--expr '(import (builtins.fetchGit {
url = "https://gist.github.com/42d420383b827d89807e9b73bf8ea65d.git";
ref = "master"; })).deployMsgGif { timestamp = "'`date +%s`'"; }'
env:
GIPHY_TOKEN: ${{ secrets.GIPHY_TOKEN }}
SLACK_BOT_CHANNEL: ${{ secrets.SLACK_BOT_CHANNEL }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN_GIT_ACTION }}
GIT_ACTOR: ${{ env.GITHUB_ACTOR }}
GIT_REF: ${{ env.GITHUB_REF }}
GIT_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
GIF_RATING: "pg-13" # https://developers.giphy.com/docs/optional-settings/#rating
GIF_TAG: "happy"
GIFED_BRANCH: ".+main"
When branch matches GIFED_BRANCH, it uses random gif with a giphy API and require GIPHY_TOKEN
security
https://dev.to/mheap/improve-your-github-actions-security-1im7 https://www.seancassidy.me/dont-pipe-to-your-shell.html
Add rev after ref, if you point specific reversion, even if I change this file you will point to old version.