📝
GitHub Actions でブランチ削除をトリガーに処理を動かす
概要
特定ブランチの削除をした時にタグを付与するよう動く GitHub Actions を検証したので備忘録としてまとめます.
検証した GitHub Actions の YAML
検証したのは下記の YAML ですが,どのブランチを消しても動いてしまうので特定ブランチのみという制御を入れたい場合は if: startsWith(github.event.ref, '[動作させたいブランチ]')
の処理を追加するなどが必要そうです.
name: Remove Branch Actions
on:
delete
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: git add tag
run: |
git tag [付けたいタグ情報]
git push origin [付けたいタグ情報]
if: startsWith(github.event.ref, '[動作させたいブランチ]')
参照情報
Discussion