Update Snyk Homebrew formula with latest release #1493
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
name: "Update Snyk Homebrew formula with latest release" | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
# Run workflow once a day to grab latest Snyk release | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
jobs: | |
brew: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Ruby 3.2 | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.2 | |
- name: Render latest template | |
run: | | |
ruby script/render.rb | tee Formula/snyk.rb | |
- name: Lint Ruby Files | |
run: | | |
gem install rubocop | |
rubocop -l | |
- name: Commit to repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.github_token }} | |
COMMIT_MSG: | | |
Upgraded to latest Snyk version | |
skip-checks: true | |
run: | | |
# Hard-code user config | |
git config user.email "snyksec@users.noreply.github.com" | |
git config user.name "Snyk" | |
git config --get-regexp "user\.(name|email)" | |
# Update origin with token | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
# Checkout the branch so we can push back to it | |
git checkout master | |
git add Formula/snyk.rb | |
# Only commit and push if we have changes | |
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin master --force) |