Release v1.3.0 #4
Workflow file for this run
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
name: リリース後のREADME更新 | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN_IRIS }} | |
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
YOUR_PERSONAL_ACCESS_TOKEN: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN }} | |
YOUR_PERSONAL_ACCESS_TOKEN_IRIS: ${{ secrets.YOUR_PERSONAL_ACCESS_TOKEN_IRIS }} | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: リポジトリのチェックアウト | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Pythonのセットアップ | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- name: 依存関係のインストール | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r .github/requirements.txt | |
pip install requests | |
- name: mainブランチの最新状態を取得 | |
run: | | |
git fetch origin main:main | |
- name: タグの強制更新 | |
run: | | |
git fetch --tags --force | |
git fetch origin main --force | |
git checkout main | |
git pull origin main | |
- name: 新しいブランチの作成 | |
run: | | |
git checkout -b update-readme-${{ github.run_id }} main | |
- name: READMEの更新 | |
run: | | |
sourcesage --ignore-file=".github/repository_summary/.iris.SourceSageignore" | |
python .github/scripts/update_readme.py | |
# echo ">[!NOTE]" >> README.md | |
# echo ">Last updated: $(date) - Release: ${{ github.event.release.tag_name }} - Run ID: ${{ github.run_id }}" >> README.md | |
# echo "<!-- Automated update -->" >> README.md | |
- name: Gitユーザー設定 | |
run: | | |
git config --global user.name "iris-s-coon" | |
git config --global user.email "[email protected]" | |
- name: 変更のコミットとプッシュ | |
run: | | |
git add README.md | |
git commit -m "📝 [docs] リリース後のREADME更新 (${{ github.event.release.tag_name }})" | |
git push origin update-readme-${{ github.run_id }} | |
- name: ブランチの差分を確認 | |
id: check_diff | |
run: | | |
git diff --quiet main..update-readme-${{ github.run_id }} || echo "has_changes=true" >> $GITHUB_OUTPUT | |
- name: ラベルの存在確認と作成 | |
if: steps.check_diff.outputs.has_changes == 'true' | |
run: | | |
LABELS=("documentation" "automated pr") | |
for LABEL in "${LABELS[@]}"; do | |
if ! gh label list | grep -q "$LABEL"; then | |
gh label create "$LABEL" --color "#0366d6" --description "Automatically created label for README updates" | |
fi | |
done | |
- name: プルリクエストの作成 | |
if: steps.check_diff.outputs.has_changes == 'true' | |
run: | | |
gh pr create --base main --head update-readme-${{ github.run_id }} \ | |
--title "📝 [docs] リリース後のREADME自動更新 (${{ github.event.release.tag_name }})" \ | |
--body "このプルリクエストは、リリース ${{ github.event.release.tag_name }} に基づいてREADMEを自動更新したものです。内容を確認し、問題がなければマージしてください。" \ | |
--label "documentation" --label "automated pr" | |
- name: プルリクエストの自動マージとブランチの削除 | |
if: steps.check_diff.outputs.has_changes == 'true' | |
run: | | |
PR_URL=$(gh pr list --head update-readme-${{ github.run_id }} --json url --jq '.[0].url') | |
gh pr merge --auto --merge "$PR_URL" | |
# マージが完了するまで待機 | |
while [[ "$(gh pr status --json state --jq '.currentBranch.state')" != "MERGED" ]]; do | |
sleep 5 | |
done | |
# ブランチの削除 | |
git push origin --delete update-readme-${{ github.run_id }} |