-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #348 from remote-jp/extract-pr-number-if-exists-in…
…-actions Enable to track the commit to generate page(s) in Actions from the corresponding PR page
- Loading branch information
Showing
1 changed file
with
12 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -63,9 +63,20 @@ jobs: | |
cd ./docs | ||
bundle install | ||
- name: 📝 Extract PR number from last commit | ||
run: | | ||
COMMIT_MESSAGE=$(git show -s --format=%s HEAD) | ||
PR_NUMBER=$(echo "$COMMIT_MESSAGE" | sed -nE 's/^Merge pull request #([0-9]+).*/\1/p') | ||
if [ -n "$PR_NUMBER" ]; then | ||
echo "PR_NUMBER=#$PR_NUMBER" >> $GITHUB_ENV; else | ||
echo "PR_NUMBER=" >> $GITHUB_ENV | ||
fi | ||
- name: 🤖 Generate page(s) by README | ||
env: | ||
TZ: 'Asia/Tokyo' | ||
PR_NUMBER: ${{ env.PR_NUMBER }} | ||
run: | | ||
cd ./docs | ||
bundle exec rake upsert_data_by_readme | ||
|
@@ -74,7 +85,7 @@ jobs: | |
git config --global user.email "[email protected]" | ||
git checkout main | ||
git add en ja | ||
git commit -m '🤖 Generate page(s) by README' | ||
git commit -m "🤖 Generate page(s) by README $PR_NUMBER" | ||
git push origin main | ||
fi | ||
|