Skip to content

Commit

Permalink
ci: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benceharomi committed Aug 28, 2024
1 parent c6076fa commit 80ed35b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- run: yarn
- run: yarn publish --tag ${{ github.event.release.tag_name }} --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_NPM_MATTERLABS_AUTOMATION_TOKEN }}
11 changes: 9 additions & 2 deletions .github/workflows/update-contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ jobs:
node-version: 18.18.0
cache: yarn

- name: fetch contracts from the given ref
- name: configure git
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- name: fetch contracts from the given ref and create a commit
run: .scripts/fetch_contracts --ref ${{ inputs.ref }}

- name: create a new branch
Expand All @@ -32,9 +37,11 @@ jobs:
run: git push origin HEAD

- name: create a pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "$(git log -1 --pretty=%B)" \
--body "Updates contracts from https://github.com/matter-labs/era-contracts/tree/${{ inputs.ref }}" \
--body "Updates contracts from https://github.com/matter-labs/era-contracts/tree/$(git log -1 --pretty=%B | grep -oE '\b([a-f0-9]{40})\b')" \
--base main \
--head $(git rev-parse --abbrev-ref HEAD)
6 changes: 3 additions & 3 deletions .scripts/fetch_contracts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if [ "$BRANCH_TAG_COMMIT" = "$COMMIT_HASH" ]; then
COMMIT_HASH_MESSAGE="$COMMIT_HASH"
else
# Otherwise, use BRANCH_TAG_COMMIT-COMMIT_HASH
COMMIT_HASH_MESSAGE_MESSAGE="$BRANCH_TAG_COMMIT - $COMMIT_HASH"
COMMIT_HASH_MESSAGE="$BRANCH_TAG_COMMIT - $COMMIT_HASH"
fi

# Set up sparse checkout and fetch only the contracts directories
Expand Down Expand Up @@ -114,8 +114,8 @@ if [ $DIFF_FOUND -eq 1 ]; then
# Clean up and commit the changes
cd "$(dirname "$DEST_DIR")"
git add contracts
git commit -m "Updated contracts ($COMMIT_HASH_MESSAGE_MESSAGE)" >/dev/null
echo "Contracts fetched, committed, and added to the destination repository from $REPO_URL ($COMMIT_HASH_MESSAGE_MESSAGE)"
git commit -m "Updated contracts ($COMMIT_HASH_MESSAGE)" >/dev/null
echo "Contracts fetched, committed, and added to the destination repository from $REPO_URL ($COMMIT_HASH_MESSAGE)"
else
echo "No changes detected, contracts are up to date. The script will exit without copying or committing."
fi
Expand Down

0 comments on commit 80ed35b

Please sign in to comment.