.github/workflows/nightly.yml #225
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
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
nightly: | |
runs-on: [self-hosted, linux, nix] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: update | |
run: ./update.sh | |
- name: commit | |
run: | | |
[[ $(git diff) != "" ]] || exit 0 | |
git config --local user.name "Prosecco" | |
git config --local user.email "[email protected]" | |
git commit -am "nightly update" | |
- name: push | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
- name: generate zulip message | |
run: | | |
{ | |
echo 'MSG<<EOF' | |
echo "*Nightly update*" | |
nix shell nixpkgs#jq --command ./message.sh | |
echo EOF | |
} >> "$GITHUB_ENV" | |
env: | |
RUN: ${{ github.run_id }} | |
- name: send zulip info message | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ "text": ${{ toJSON(env.MSG) }} } | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ZULIP_WEBHOOK_URL }} | |
- name: send zulip error message | |
if: ${{ failure() }} | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ "text": "Unexpected Error: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" } | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.ZULIP_WEBHOOK_URL }} |