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

build: switch to code-suggester action #990

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all 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
56 changes: 15 additions & 41 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,52 +18,26 @@ jobs:
run: npm ci
- name: build
run: npm run build
- name: commit
run: |-
set -e
# get current commit hash
CURRENT_HASH=$(git rev-parse HEAD)
# get last commit hash of last build dist
LAST_BUILD_HASH=$(git log --author=google-github-actions-bot -1 --pretty=format:"%H")
DIFF=""
# build and commit dist if diff
git config --global user.name "actions-bot"
git config user.email '[email protected]'
git add dist/
git diff-index --quiet HEAD || git commit -m "chore: build dist ${ACTION_NAME}"
# if last commit hash of last build dist was found, get logs of commits in btw for PR body
if [ -z "$LAST_BUILD_HASH" ]
then
echo "Unable to find last commit by bot, skipping diff gen"
else
DIFF=$(git log ${LAST_BUILD_HASH}...${CURRENT_HASH} --oneline)
echo $DIFF
fi
# set env vars
echo "CURRENT_HASH=${CURRENT_HASH}" >> $GITHUB_ENV
echo "LAST_BUILD_HASH=${LAST_BUILD_HASH}" >> $GITHUB_ENV
echo 'DIFF<<EOF' >> $GITHUB_ENV
echo "${DIFF}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Create PR with dist
uses: peter-evans/create-pull-request@v5
uses: googleapis/code-suggester@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
commit-message: Build dist
author: "actions-bot <[email protected]>"
upstream_repo: release-please-action
upstream_owner: googleapis
description: Build dist
title: "chore: build dist"
body: |
Build dist PR
${{env.DIFF}}
message: "chore: build dist"
labels: automated pr
branch: create-pull-request/build-dist
delete-branch: true
push-to-fork: google-github-actions-bot/${{env.ACTION_NAME}}
branch: build-dist
force: true
git_dir: .
fork: true
env:
ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
release-please-release:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: google-github-actions/release-please-action@main
- uses: googleapis/release-please-action@main
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -74,7 +48,7 @@ jobs:
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/google-github-actions/release-please-action.git"
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN}}@github.com/googleapis/release-please-action.git"
git tag -d v${{ steps.release.outputs.major }} || true
git tag -d v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }} || true
git push origin :v${{ steps.release.outputs.major }} || true
Expand All @@ -91,9 +65,9 @@ jobs:
- release-please-release
steps:
- id: release-pr
uses: google-github-actions/release-please-action@main
uses: googleapis/release-please-action@main
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
release-type: node
fork: true
skip-github-release: true
Loading