Skip to content
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

automate hashes.json update #2331

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
35 changes: 35 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
merge_group:
branches:
- main
workflow_dispatch:

permissions:
contents: write
pull-requests: write
repository-projects: write

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_NX_TOKEN }}
Expand Down Expand Up @@ -44,6 +50,35 @@ jobs:
- name: Build, Lint, Test & Typecheck
run: yarn nx affected -t build,lint,test,typecheck

# Temporary disabled until we can automate this
- name: Validate Checkout Widgets Hashes
id: validate_checkout_widgets_hashes
zaidarain1 marked this conversation as resolved.
Show resolved Hide resolved
run: |
cd packages/checkout/widgets-lib
yarn updateHashes
if [ -n "$(git diff --exit-code hashes.json)" ]; then
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add hashes.json
git commit -m "Update hashes.json"
git push
echo "HASH_UPDATED=true" >> $GITHUB_OUTPUT
fi

- name: Retrigger workflow
if: steps.validate_checkout_widgets_hashes.outputs.HASH_UPDATED == 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if: steps.validate_checkout_widgets_hashes.outputs.HASH_UPDATED == 'true'
if: steps.validate_checkout_widgets_hashes.outputs.HASH_UPDATED == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

uses: actions/github-script@v6
with:
script: |
const workflow = `${{ github.workflow }}`;
const ref = `${{ github.event.pull_request.head.ref }}`;
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow,
ref: ref
});

build-lint-test-examples:
name: Build, Lint & Test Examples
runs-on: ubuntu-latest-8-cores
Expand Down
2 changes: 2 additions & 0 deletions packages/checkout/widgets-lib/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from './factory';

export const bla = 'test';
Loading