Skip to content

didc Update

didc Update #250

Workflow file for this run

# A GitHub Actions workflow that regularly checks for new `didc` releases
# and creates a PR on new versions.
name: didc Update
on:
schedule:
# check for new `didc` releases every tuesday at 7:30.
- cron: '30 7 * * TUE'
workflow_dispatch:
jobs:
didc-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# First, check `didc` releases (on the candid repo) for a new version.
- name: Check new didc version
id: update
run: |
pwd
find .github/actions
current_didc_release=$(jq -r '.defaults.build.config.DIDC_VERSION' dfx.json)
echo "current didc release '$current_didc_release'"
latest_didc_release=$(curl -sSL https://api.github.com/repos/dfinity/candid/releases/latest | jq .tag_name -r)
echo "latest didc release '$latest_didc_release'"
if [ "$current_didc_release" != "$latest_didc_release" ]
then
echo didc needs an update
sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge
DIDC_RELEASE="$latest_didc_release" jq '.defaults.build.config.DIDC_VERSION=(env.DIDC_RELEASE)' dfx.json | sponge dfx.json
echo "updated=1" >> "$GITHUB_OUTPUT"
echo "version=$latest_didc_release" >> "$GITHUB_OUTPUT"
else
echo "updated=0" >> "$GITHUB_OUTPUT"
fi
jq '.defaults.build.config.DIDC_VERSION' dfx.json
echo "Git status:"
git status
echo "Changes:"
git diff
# If `dfx.json` was updated, create a PR.
- name: Create Pull Request
if: ${{ steps.update.outputs.updated == '1' }}
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GIX_CREATE_PR_PAT }}
base: main
reviewers: mstrasinskis, dskloetd
# Note: Please be careful when updating the add-paths field. We have had the snsdemo committed by accident, with a pattern that matches nothing seemingly committing everything.
add-paths: dfx.json
commit-message: Update didc release
committer: GitHub <noreply@github.com>
author: gix-bot <gix-bot@users.noreply.github.com>
branch: bot-didc-update
branch-suffix: timestamp
delete-branch: true
title: 'bot: Update didc release to ${{ steps.update.outputs.version }}'
body: |
# Motivation
A newer version of `didc` is available.
Even with no changes, just updating the reference is good practice.
# Changes
## Changes made by a bot triggered by ${{ github.actor }}
- Update the version of `didc` specified in `dfx.json`.
## Changes made by a human (delete if inapplicable)
# Tests
- CI contains tests that detect most breaking changes in `didc`.
- [ ] Please check [the didc release notes](https://github.com/dfinity/candid/releases) (if any).
- [ ] Please check [the didc git history](https://github.com/dfinity/candid/commits/master/tools/didc) (if reasonably short and understandable).
# Since 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: "didc update failed"