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

Add Artikodin workflow #2

Merged
merged 1 commit into from
Jan 2, 2024
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
73 changes: 73 additions & 0 deletions .github/workflows/artikodin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Artikodin pull-request handler


on:
# Runs on a pull request for the main branch
pull_request:
types:
# Default events
- opened
- synchronize
- reopened
# But we also want to make sure a potential
# exception request pull request is getting
# closed if any was open
- closed
branch:
- main

# Runs on a merge group build
merge_group:
types:
- checks_requested


concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: false

jobs:
handle:
name: Run Artikodin handler

runs-on: ubuntu-latest

steps:
- name: Getting an app token if Artikodin is available
env:
ARTIKODIN_CONTROLLER_APP_ID: ${{ secrets.ARTIKODIN_CONTROLLER_APP_ID }}
ARTIKODIN_CONTROLLER_PRIVATE_KEY: ${{ secrets.ARTIKODIN_CONTROLLER_PRIVATE_KEY }}
ARTIKODIN_CONTENTS_APP_ID: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
ARTIKODIN_CONTENTS_PRIVATE_KEY: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
if: ${{ env.ARTIKODIN_CONTROLLER_APP_ID != '' && env.ARTIKODIN_CONTROLLER_PRIVATE_KEY != '' && env.ARTIKODIN_CONTENTS_APP_ID != '' && env.ARTIKODIN_CONTENTS_PRIVATE_KEY != '' }}
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
private-key: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
owner: temporalio
repositories: artikodin

- name: Checkout Artikodin
if: ${{ steps.app-token.outputs.token != '' }}
uses: actions/checkout@v4
with:
repository: temporalio/artikodin
ref: main
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

- name: Synchronize authorization
if: ${{ steps.app-token.outputs.token != '' }}
uses: ./request
with:
skip-checkout: true
contents-app-id: ${{ secrets.ARTIKODIN_CONTENTS_APP_ID }}
contents-private-key: ${{ secrets.ARTIKODIN_CONTENTS_PRIVATE_KEY }}
controller-app-id: ${{ secrets.ARTIKODIN_CONTROLLER_APP_ID }}
controller-private-key: ${{ secrets.ARTIKODIN_CONTROLLER_PRIVATE_KEY }}
target-repository: "${{ github.repository }}"
target-pull-request: "${{ github.event.pull_request.number }}"
target-merge-group-head-ref: "${{ github.event.merge_group.head_ref }}"
target-git-sha: "${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}"
closing-pr: ${{ github.event.action == 'closed' }}