Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad0 committed Feb 5, 2024
1 parent d1e5d64 commit 8320883
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/mirror_noir_subrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Get noir master's last sync commit
id: last_merge_hash
uses: actions/github-script@v7
with:
script: |
// NOTE: more robust heuristic needed if aztecbot opens different kinds of PRs
const response = await github.rest.search.commits({
q: 'author:AztecBot committer:web-flow repo:noir-lang/noir sort:committer-date'
});
console.log(response.data.items);
return response.data.items[0].sha;
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}

# We push using git subrepo (https://github.com/ingydotnet/git-subrepo)
# and push all Aztec commits as a single commit with metadata.
- name: Push to branch
Expand All @@ -46,10 +58,18 @@ jobs:
# Reset our branch to our expected target
git push origin $BRANCH --force
cd ..
# Now push to it with subrepo with all non-noise commit messages
MESSAGE=$(git log --pretty=format:"%s" $BASE_AZTEC_COMMIT..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo || true')
# Get the last merged PR
LAST_MERGED_PR_HASH=`gh pr list --repo=noir-lang/noir --state merged --head aztec-packages --json headRefOid --jq=.[0].headRefOid`
COMMIT_HEURISTIC=$(git log -p -S"$LAST_MERGED_PR_HASH" --reverse --source -- noir/.gitrepo | grep -m 1 '^commit' | awk '{print $2}' || true)
if [[ " $COMMIT_HEURISTIC" = "" ]] ; then
COMMIT_HEURISTIC=$BASE_AZTEC_COMMIT
fi
MESSAGE=$(git log --pretty=format:"%s" $COMMIT_HEURISTIC..HEAD -- noir/ ':!noir/.gitrepo' | grep -v 'git subrepo || true')
# Fix Aztec PR links
MESSAGE=$(echo "$MESSAGE" | sed -E 's/\(#([0-9]+)\)/(https:\/\/github.com\/AztecProtocol\/aztec-packages\/pull\/\1)/g')
git commit --allow-empty -m"chore: Sync to noir-lang/noir" -m"$MESSAGE"
COMMIT=$(git rev-parse HEAD)
# Now push to it with subrepo with computed commit messages
if ./scripts/git_subrepo.sh push $SUBREPO_PATH --squash --branch=$BRANCH; then
git reset $COMMIT
git commit --amend -am "$(git log -1 --pretty=%B) [skip ci]"
Expand Down

0 comments on commit 8320883

Please sign in to comment.