Monitor Upstream Releases #211
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: Monitor Upstream Releases | |
on: | |
schedule: | |
- cron: '*/30 * * * *' # Check every 30 minutes | |
jobs: | |
check-releases: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: Check for new releases | |
env: | |
GH_TOKEN: ${{ secrets.PAT_TOKEN }} | |
run: | | |
# Get latest upstream release using gh cli | |
LATEST_RELEASE=$(gh api \ | |
repos/MetaMask/metamask-extension/releases/latest \ | |
--jq .tag_name) | |
echo "Latest upstream release: $LATEST_RELEASE" | |
# Check if we already have this release | |
if gh release view "${LATEST_RELEASE}-no-lavamoat" --repo ${{ github.repository }} &>/dev/null; then | |
echo "Release ${LATEST_RELEASE}-no-lavamoat already exists. Skipping." | |
exit 0 | |
fi | |
# If we don't have the release, trigger the build | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.PAT_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Content-Type: application/json" \ | |
https://api.github.com/repos/${{ github.repository }}/dispatches \ | |
-d "{\"event_type\": \"upstream-release\", \"client_payload\": {\"release\": \"$LATEST_RELEASE\"}}" |