Skip to content

Commit

Permalink
feat(gha): add scheduled poll action
Browse files Browse the repository at this point in the history
  • Loading branch information
curiositycasualty committed Feb 27, 2023
1 parent 9d45b82 commit 281e2f6
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/poll.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Release

on: # yamllint disable-line rule:truthy
schedule:
# wednesday, friday at 00:00
- cron: '0 0 * * 3,5'
workflow_dispatch:

jobs:
release:
name: Poll OpenSSL Website
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- env:
GITHUB_TOKEN: ${{ secrets.token }}
DEBUG: ${{ runner.debug == '1' && '1' || '' }}
run: |
if [ -n "${DEBUG:-}" ]; then
set -x
fi
fresh="$(
grep -Eo -m1 -i '1\.1\.1.*available' <(
curl -Ls 'https://www.openssl.org/news/newslog.html'
) | cut -d' ' -f1
)"
stale="$(cat .env)"
message="chore(*): update OpenSSL to ${fresh}"
if [[ "$fresh" != "$stale" ]] ; then
# PR already created for fresh version
if gh pr list | grep "$message"; then
exit 0
fi
git checkout -b chore/openssl-${fresh}
echo "$fresh" > .env
git add .env
git commit -m "chore(*): update OpenSSL to ${fresh}"
pr="$(gh pr create --fill | grep -Eo '\d+$')"
gh pr merge --auto "$pr"
fi

0 comments on commit 281e2f6

Please sign in to comment.