Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: backport dispatch-push-event workflow to v0.3.17 #873

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/dispatch-push-event.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: dispatch-push-event
on:
push:

jobs:
search-dispatch-repo:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- { version: beta/v0.3.**, dispatch-repo: pilot-auto.x1.eve }
outputs:
dispatch-repo: ${{ steps.search-dispatch-repo.outputs.value }}
steps:
- name: Search dispatch repo
id: search-dispatch-repo
run: |
if [[ ${{ github.ref_name }} =~ ${{ matrix.version }} ]]; then
echo ::set-output name=value::"${{ matrix.dispatch-repo }}"
echo "Detected beta branch: ${{ github.ref_name }}"
echo "Dispatch repository: ${{ matrix.dispatch-repo }}"
fi

dispatch-push-event:
runs-on: ubuntu-latest
needs: search-dispatch-repo
if: ${{ needs.search-dispatch-repo.outputs.dispatch-repo != '' }}
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.INTERNAL_APP_ID }}
private_key: ${{ secrets.INTERNAL_PRIVATE_KEY }}

# 注意: workflow_dispatchで指定するブランチはmain固定となっているため、dispatch-repoのmainブランチにupdate-beta-branch.yamlが存在することが前提条件。
- name: Dispatch the update-beta-branch workflow
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ steps.generate-token.outputs.token }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/tier4/${{ needs.search-dispatch-repo.outputs.dispatch-repo }}/actions/workflows/update-beta-branch.yaml/dispatches \
-d '{"ref":"main"}'
Loading