-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 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,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" |
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 |
---|---|---|
|
@@ -114,3 +114,6 @@ dist | |
|
||
# Built documentation | ||
/docs/ | ||
|
||
# IC if checked out, e.g. in CI | ||
/ic/ |