-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflow to update IC #468
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
3978872
Workflow to update IC
bitdivine 7a6cf47
++
bitdivine 938a32f
log++
bitdivine 3e08496
Merge remote-tracking branch 'origin/main' into update-ic
bitdivine c89f142
Enable PR
bitdivine f3dd113
Include tags in label
bitdivine 7e402b1
Revert "Include tags in label"
bitdivine ffb83e5
By default, upgrade to the latest release
bitdivine 2d17fe1
Update secret name
bitdivine 2aecad1
Update token
bitdivine ab202c8
token
bitdivine eb23ea3
add-paths
bitdivine 431ef7d
Better PR body
bitdivine f72fb74
Merge remote-tracking branch 'origin/main' into update-ic
bitdivine f9edbc5
Merge branch 'main' into update-ic
bitdivine 373b76e
Bump didc to match
bitdivine 7d55de3
feedback: Rename
bitdivine e66d60e
Merge remote-tracking branch 'origin/main' into update-ic
bitdivine 976c4b7
chnagelog
bitdivine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,102 @@ | ||
# 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: Choose IC ref | ||
id: choose_ic_ref | ||
run: | | ||
ref="${{ inputs.ic_ref }}" | ||
if [[ "${requested_ref:-}" == "" ]] | ||
then # Use the latest release | ||
ref="$(gh release --repo dfinity/ic view --json tagName -q .tagName)" | ||
fi | ||
echo "ic_ref=$ref" >> "$GITHUB_OUTPUT" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- name: Checkout ic repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: dfinity/ic | ||
ref: ${{ steps.choose_ic_ref.outputs.ic_ref }} | ||
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/2023-09-27/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. | ||
set +x # Printing the diff to stderr repeatedly can be very noisy. | ||
DIFF_IGNORING_PROVENANCE="$(git diff -I '\/\/ Generated from IC repo.*')" | ||
if [[ "${DIFF_IGNORING_PROVENANCE:-}" == "" ]] | ||
then | ||
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" | ||
else | ||
echo "API changes detected!" | ||
git status | ||
echo "updated=1" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Create Pull Request | ||
if: ${{ steps.update.outputs.updated == '1' }} | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.GIX_CREATE_PR_PAT }} | ||
base: main | ||
add-paths: | | ||
packages/**/*.did | ||
packages/**/*.js | ||
packages/**/*.ts | ||
commit-message: Update IC commit | ||
committer: GitHub <[email protected]> | ||
author: gix-bot <[email protected]> | ||
branch: bot-ic-update | ||
branch-suffix: timestamp # Creates a new branch & PR with every run. If this gets spammy, please delete this line and instead block the PR from making a PR if there is already an open one. | ||
delete-branch: true | ||
title: 'Update IC Candid Files' | ||
body: | | ||
# Motivation | ||
The Internet Computer APIs have updated. | ||
|
||
# Changes | ||
* Updated the interface description files for the Internet Computer. | ||
* Updated the javascript bindings for the latest IC interface. | ||
|
||
# Tests | ||
- [ ] Please check the API updates for any breaking changes that affect our code. | ||
- name: Notify Slack on failure | ||
# 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. | ||
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/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename this step?
How about "Update candid and related JS and TS files"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done