-
Notifications
You must be signed in to change notification settings - Fork 46
50 lines (44 loc) · 2.01 KB
/
Copy pathupdate-plugins.yml
File metadata and controls
50 lines (44 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Update Plugin Hash
on:
repository_dispatch:
types: [plugin_updated]
# Ensure the workflow has permissions to manage PRs and update contents
permissions:
contents: write
pull-requests: write
jobs:
update-store:
runs-on: ubuntu-latest
steps:
- name: Checkout Store Repo
uses: actions/checkout@v4
- name: Update Plugins.json
env:
REPO_URL: ${{ github.event.client_payload.repo_url }}
COMMIT_SHA: ${{ github.event.client_payload.commit_sha }}
run: |
# Sets the entry's hash to the new commit SHA.
jq --arg url "$REPO_URL" --arg sha "$COMMIT_SHA" \
'map(if .url == $url then .hash = $sha else . end)' \
Plugins.json > temp.json && mv temp.json Plugins.json
- name: Extract Plugin Name
id: plugin_info
run: |
# Extracts the repository name (e.g., "MediaPlugin") from the full URL
PLUGIN_NAME=$(echo "${{ github.event.client_payload.repo_url }}" | awk -F'/' '{print $5}')
echo "name=$PLUGIN_NAME" >> $GITHUB_OUTPUT
- name: Create New Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.STORE_AUTOMATION_TOKEN }}
commit-message: "update(${{ steps.plugin_info.outputs.name }}): update hash for ${{ github.event.client_payload.version }}"
title: "Update ${{ steps.plugin_info.outputs.name }} to ${{ github.event.client_payload.version }}"
body: |
Automated update of commit hash for plugin: ${{ steps.plugin_info.outputs.name }}
- **Version/Branch:** ${{ github.event.client_payload.version }}
- **Commit SHA:** ${{ github.event.client_payload.commit_sha }}
# Stable per-plugin branch name: create-pull-request reuses it (updating the
# existing open PR in place) instead of piling up a new branch per commit SHA.
branch: "update-plugin-${{ steps.plugin_info.outputs.name }}"
delete-branch: true
base: main