generated from 18F/open-source-policy
-
Notifications
You must be signed in to change notification settings - Fork 5
39 lines (37 loc) · 1.44 KB
/
keep-binary-updated.yml
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
39
---
name: Keep binary updated
# Periodically rebuild from the upstream "latest" releases, then raise a new
# pull-request if the binary file changed.
#
# Cribs heavily from this example:
# https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#use-case-create-a-pull-request-to-modifyfix-pull-requests
on:
workflow_dispatch:
schedule:
# Runs every night around 4:20am EST/1:20am PST
- cron: "20 8 * * *"
jobs:
keep-binary-up-to-date:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Regenerate binary
run: make
- name: Did anything change?
id: vars
run: |
branchname="binary-update/${{ github.ref_name }}"
echo "branchname=${branchname}" >> $GITHUB_OUTPUT
binaryupdated=$(git status --porcelain | cut -d ' ' -f 2 | wc -l)
echo "binaryupdated=${binaryupdated}" >> $GITHUB_OUTPUT
- name: Create PR with changes
if: steps.vars.outputs.binaryupdated != 0
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update binary for ${{ github.ref_name }}
title: Update caddy binary for ${{ github.ref_name }}
body: This is an auto-generated PR to add an updated binary on ${{ github.ref_name }}.
labels: binary-update, automated-pr
branch: ${{ steps.vars.outputs.branchname }}
base: ${{ github.ref_name }}
sign-commits: true