Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/actions/add-and-commit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Add and Commit
description: Set git remote and commit changes (e.g., formatting)

inputs:
add:
description: Files to add
required: false
default: '.'
message:
description: Commit message
required: true
token:
description: GitHub token
required: true

runs:
using: 'composite'
steps:
# Checkout runs with persist-credentials: false, so re-supply the token to
# git (scoped to this local repo) enabling add-and-commit to push.
- name: Set git remote silently and locally
run: |
git config url."https://github-actions:$GITHUB_TOKEN@github.com/".insteadOf "https://github.com/"
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash

- name: Commit
uses: EndBug/add-and-commit@290ea2c423ad77ca9c62ae0f5b224379612c0321 # v10.0.0
with:
add: ${{ inputs.add }}
default_author: github_actions
message: ${{ inputs.message }}

- name: Unset local git remote config
run: |
git config --unset-all url."https://github-actions:${GITHUB_TOKEN}@github.com/".insteadOf || true
git config --unset-all url."https://github.com/".insteadOf || true
env:
GITHUB_TOKEN: ${{ inputs.token }}
shell: bash
46 changes: 44 additions & 2 deletions .github/workflows/lib-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,59 @@ jobs:
name: Format
runs-on: ubuntu-latest
permissions:
contents: read
contents: write # Required to commit and push formatting changes back to the pull request branch.

steps:
- name: Create GitHub App Token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
continue-on-error: true
id: app-token
with:
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
- name: Check if commits can be added
id: check_can_add_commit
run: |
echo "can_add_commit=$CAN_ADD_COMMIT" >> $GITHUB_OUTPUT
env:
CAN_ADD_COMMIT: ${{ steps.app-token.outputs.token != '' && github.event_name == 'pull_request' }}
- name: Checkout for pull request
if: steps.check_can_add_commit.outputs.can_add_commit == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Checkout
if: steps.check_can_add_commit.outputs.can_add_commit == 'false'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Prepare
uses: ./.github/actions/prepare
- name: Format
run: npm run format:check
run: npm run format
- name: Check for changes
id: check_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes_detected=true" >> $GITHUB_OUTPUT
else
echo "changes_detected=false" >> $GITHUB_OUTPUT
fi
- name: Commit format
if: steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_changes.outputs.changes_detected == 'true'
uses: ./.github/actions/add-and-commit
with:
message: '🤖 Apply formatting changes'
token: ${{ steps.app-token.outputs.token }}
- name: Provide diff
if: steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_changes.outputs.changes_detected == 'true'
run: |
echo "FIX: Please run 'npm run format' and commit the result."
git diff
exit 1

lint:
name: Lint
Expand Down
3 changes: 1 addition & 2 deletions src/icrc-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ export class IcrcWallet extends RelyingParty {
});

type TransferFromResult =
| {Ok: IcrcLedgerDid.BlockIndex}
| {Err: IcrcLedgerDid.TransferFromError};
{Ok: IcrcLedgerDid.BlockIndex} | {Err: IcrcLedgerDid.TransferFromError};

const response = await decodeResponse<TransferFromResult>({
params: callParams,
Expand Down
5 changes: 1 addition & 4 deletions src/types/signer-builders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@ export interface SignerBuilderParams {
export type SignerBuilderFn = (params: SignerBuilderParams) => Promise<SignerBuildersResult>;

export type SignerBuilderMethods =
| 'icrc1_transfer'
| 'icrc2_approve'
| 'icrc2_transfer_from'
| string;
'icrc1_transfer' | 'icrc2_approve' | 'icrc2_transfer_from' | string;
Loading