GitHub Actionsでbitrise.ymlをダウンロードしてPRを作る
bitrise.ymlを追跡可能にする
Bitriseはワークフローエディターがよくできているので、基本WebインターフェースでWorkflow作っています
が、変更履歴がわからなかったり設定ファイルはGitで管理したいです。
しかしbitrise.ymlをワークフローで使うには制約があったり、いろいろと大変なのであまりやりたくない。
そこで、bitriseからダウンロードしてきてGitに反映させる方法を取ります。
FastfileとBitriseで動かしてるやつはあったから、GitHub Actionsでやってみる
準備するもの
- BitriseのPersonal access tokens
- GitHub リポジトリ
- SecretsにBITRISE_APP_SLUGとBITRISE_ACCESS_TOKENを登録
Github Actions
.github/workflows/sync_bitrise.yml
name: sync_bitrise
on:
schedule:
# 平日前の2時に実行(UTC)
- cron: "0 17 * * 0-4"
jobs:
sync:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Download bitrise.yml
run: |
curl -O 'https://api.bitrise.io/v0.1/apps/${{ secrets.BITRISE_APP_SLUG }}/bitrise.yml' -H 'Authorization: ${{ secrets.BITRISE_ACCESS_TOKEN }}'
shell: bash
- name: Create pull request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Sync bitrise.yml
branch: ci/sync-bitrise
branch-suffix: timestamp