Skip to content

Commit

Permalink
Workflow to update IC
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine committed Nov 14, 2023
1 parent e9cf929 commit 3978872
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/update-ic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# A GitHub Actions workflow that regularly makes a PR to update
# the IC candid and code bindings.
name: Update IC
on:
schedule:
# Checks for new IC commit weekly
- cron: '30 3 * * MON'
workflow_dispatch:
# Provides an option to run this manually.
ic_ref:
description: "The IC commit or tag to update to."
required: false
push:
branches:
# Runs if there is a change to the development branch for this workflow:
- "update-ic"
jobs:
update-ic:
runs-on: ubuntu-latest
steps:
- name: Checkout ic-js
uses: actions/checkout@v3
- name: Checkout ic repo
uses: actions/checkout@v3
with:
repository: dfinity/ic
ref: ${{ inputs.ic_ref }} # Defaults to the default IC branch, currently "master".
path: ic
- name: Check new IC commit
id: update
run: |
set -euxo pipefail
# Gets prettier in a minute
npm ci
# Gets candid
./scripts/import-candid ic
# Derives consequences
./scripts/compile-idl-js
# Checks whether it was all for nothing.
# ... Note: Ignores how we got here.
if git diff -I '\/\/ Generated from IC repo.*' | grep -q .
then
echo "API changes detected!"
echo "updated=1" >> "$GITHUB_OUTPUT"
else
echo "updated=0" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: ${{ (steps.update.outputs.updated == '1') && false }}
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GIX_SNSDEMO_BOT_GH_TOKEN }}
base: main
add-paths: |
bin/versions.bash
commit-message: Update IC commit
committer: GitHub <[email protected]>
author: gix-bot <[email protected]>
branch: bot-ic-update
delete-branch: true
title: 'Update IC commit'
# Since the this is a scheduled job, a failure won't be shown on any
# PR status. To notify the team, we send a message to our Slack channel on failure.
- name: Notify Slack on failure
uses: dfinity/internet-identity/.github/actions/slack@release-2023-08-28
if: ${{ failure() }}
with:
WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MESSAGE: "IC commit update failed"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,6 @@ dist

# Built documentation
/docs/

# IC if checked out, e.g. in CI
/ic/

0 comments on commit 3978872

Please sign in to comment.