generated from Kong/template-github-release
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gha): add scheduled poll action
- Loading branch information
1 parent
9d45b82
commit 281e2f6
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
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
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 |