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

[update] remove bot branch dependency #18

Merged
merged 8 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ inputs:
dependency:
description: 'The used dependency'
required: true
is_composite:
description: 'Is this a composite action repository ?'
required: false
default: 'false'
user:
description: 'The User of this repository'
required: true
Expand Down Expand Up @@ -44,9 +48,11 @@ runs:
git show-ref --tags "${tag:-"${USED}"}" --quiet && git checkout "${tag:-"${USED}"}"
printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}"

- uses: tiawl/spaceporn-dep-action-cd-ping@bot
- uses: actions/checkout@v4
- uses: ./
with:
repository_name: "${{ inputs.dependency }}"
is_composite: "${{ inputs.is_composite }}"
user: "${{ inputs.user }}"
tag: "${{ steps.prepare.outputs.tag }}"
token: "${{ inputs.token }}"
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
- uses: ./.github/actions/ci
with:
dependency: 'spaceporn-dep-action-env'
is_composite: 'true'
user: "${{ matrix.user }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
Expand All @@ -197,6 +198,7 @@ jobs:
- uses: ./.github/actions/ci
with:
dependency: 'spaceporn-dep-action-bot'
is_composite: 'true'
user: "${{ matrix.user }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
Expand All @@ -221,6 +223,7 @@ jobs:
- uses: ./.github/actions/ci
with:
dependency: 'spaceporn-dep-action-ci'
is_composite: 'true'
user: "${{ matrix.user }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
Expand Down Expand Up @@ -250,6 +253,7 @@ jobs:
- uses: ./.github/actions/ci
with:
dependency: 'spaceporn-dep-action-cd-ping'
is_composite: 'true'
user: "${{ matrix.user }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
Expand Down Expand Up @@ -280,6 +284,7 @@ jobs:
- uses: ./.github/actions/ci
with:
dependency: 'spaceporn-dep-action-cd-pong'
is_composite: 'true'
user: "${{ matrix.user }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
Expand Down Expand Up @@ -337,9 +342,11 @@ jobs:
git show-ref --tags "${tag:-"${USED}"}" --quiet && git checkout "${tag:-"${USED}"}"
printf 'tag=%s\n' "${tag:-"${USED}"}" >> "${GITHUB_OUTPUT}"

- uses: tiawl/spaceporn-dep-action-cd-ping@bot
- uses: actions/checkout@v4
- uses: ./
with:
repository_name: "${{ matrix.repo }}"
user: "${{ github.event.repository.name }}"
tag: "${{ steps.prepare.outputs.tag }}"
token: "${{ secrets.PAT }}"
- uses: actions/checkout@v4
16 changes: 15 additions & 1 deletion .github/workflows/dump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@ name: dump
on:
repository_dispatch:
types:
- ping
- ping-toolbox
- ping-vulkan.zig
- ping-wayland.zig
- ping-X11.zig
- ping-glfw.zig
- ping-cimgui.zig
- ping-spirv.zig
- ping-glslang.zig
- ping-shaderc.zig
- ping-spaceporn
- ping-spaceporn-dep-action-env
- ping-spaceporn-dep-action-bot
- ping-spaceporn-dep-action-ci
- ping-spaceporn-dep-action-cd-ping
- ping-spaceporn-dep-action-cd-pong

jobs:
dump:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
- spaceporn-dep-action-cd-pong
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: tiawl/spaceporn-dep-action-cd-ping@v1
with:
repository_name: "${{ github.event.repository.name }}"
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/pong.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: cd pong
on:
repository_dispatch:
types:
- ping
- ping-spaceporn-dep-action-env
- ping-spaceporn-dep-action-cd-ping
- ping-spaceporn-dep-action-cd-pong

jobs:
pong:
Expand All @@ -12,12 +14,9 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: "${{ secrets.PAT }}"
- uses: tiawl/spaceporn-dep-action-cd-pong@v1
if: contains(fromJSON('["spaceporn-dep-action-env","spaceporn-dep-action-cd-ping", "spaceporn-dep-action-cd-pong"]'), github.event.client_payload.dependency)
with:
repository: "${{ github.repository }}"
dependency: "${{ github.event.client_payload.dependency }}"
tag: "${{ github.event.client_payload.tag }}"
hash: "${{ github.event.client_payload.hash }}"
Expand Down
21 changes: 15 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ inputs:
is_composite:
description: 'Is this a composite action repository ?'
required: false
default: false
default: 'false'
user:
description: 'The User of this repository'
required: true
Expand All @@ -27,19 +27,28 @@ runs:
with:
version: ${{ env.zig_version }}

- uses: actions/checkout@v4
with:
repository: "${{ github.repository_owner }}/${{ inputs.repository_name }}"
fetch-depth: 0
fetch-tags: true

- name: Notify ${{ inputs.user }}
env:
DEPENDENCY: "client_payload[dependency]=${{ inputs.repository_name }}"
ENDPOINT: "/repos/${{ github.repository_owner }}/${{ inputs.user }}/dispatches"
EVENT_TYPE: 'event_type=ping'
EVENT_TYPE: "event_type=ping-${{ inputs.repository_name }}"
GH_TOKEN: "${{ inputs.token }}"
IS_COMPOSITE: "${{ inputs.is_composite }}"
TAG: "client_payload[tag]=${{ inputs.tag }}"
PAYLOAD_DEPENDENCY: "client_payload[dependency]=${{ inputs.repository_name }}"
PAYLOAD_TAG: "client_payload[tag]=${{ inputs.tag }}"
TAG: "${{ inputs.tag }}"
shell: ${{ env.shell }}
run: |
hash="client_payload[hash]=$(if [[ "${IS_COMPOSITE}" != 'true' ]]; then zig fetch .; fi)"
git show-ref --tags "${TAG}" --quiet && git checkout "${TAG}"
payload_hash="client_payload[hash]=$(if [[ "${IS_COMPOSITE}" != 'true' ]]; then zig fetch .; fi)"
gh api --method POST \
-H 'Accept: application/vnd.github+json' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
-f "${EVENT_TYPE}" -F "${DEPENDENCY}" -F "${TAG}" -F "${hash}" \
-f "${EVENT_TYPE}" \
-F "${PAYLOAD_DEPENDENCY}" -F "${PAYLOAD_TAG}" -F "${payload_hash}" \
"${ENDPOINT}"