-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create workflow for make upgrade (#2823)
- Loading branch information
1 parent
d3e86ad
commit 0190449
Showing
4 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Make upgrade | ||
on: | ||
schedule: | ||
# Run every Monday at 10am UTC | ||
- cron: '0 10 * * 1' | ||
env: | ||
APP_ID: 251311 | ||
jobs: | ||
prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get GitHub app token | ||
uses: actions/create-github-app-token@v1 | ||
id: app_token | ||
with: | ||
app-id: ${{ env.APP_ID }} | ||
private-key: ${{ secrets.TOKEN_EXCHANGE_GH_APP_PRIVATE_KEY }} | ||
- name: Checkout repository code | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ steps.app_token.outputs.token }} | ||
- name: Set up Git name and email | ||
run: | | ||
git config user.name 'github-actions[bot]' | ||
git config user.email 'github-actions[bot]@users.noreply.github.com' | ||
- name: Make upgrade | ||
run: bash ./make/buf/scripts/githubactionmakeupgrade.bash | ||
env: | ||
GH_TOKEN: ${{ steps.app_token.outputs.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
DIR="$(CDPATH= cd "$(dirname "${0}")/../../.." && pwd)" | ||
cd "${DIR}" | ||
|
||
# Ensure the following environment variables are set: | ||
: "${GH_TOKEN}" # However, if you are already logged in for GitHub CLI locally, you can remove this line when running it locally. | ||
|
||
make upgrade | ||
|
||
if ! [[ $(git status --porcelain) ]]; then | ||
echo "No changes detected. Exiting." | ||
exit 0 | ||
fi | ||
|
||
DATE=$(date +"%Y-%m-%d") | ||
BRANCH="make-upgrade-${DATE}" | ||
git switch -C "${BRANCH}" | ||
git add . | ||
git commit -m "Make upgrade" | ||
git push --set-upstream origin "${BRANCH}" | ||
PR_URL=$(gh pr create --title "Make upgrade" --body "Created on ${DATE}." --base main --head "${BRANCH}") | ||
echo "Pull request created: ${PR_URL}" |