Workflow file for this run
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
# 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 didc | |
echo "$PATH" | tr : "\n" | |
mkdir -p "$HOME/.local/bin" | |
curl -Lf https://github.com/dfinity/candid/releases/download/2022-08-09/didc-linux64 | install -m 755 /dev/stdin "$HOME/.local/bin/didc" | |
# 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 | |
commit="$(cd ic && git rev-parse --short HEAD)" | |
echo "No signficant differences found in IC ref ${{ inputs.ic_ref }} (commit $commit)." | |
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" |