-
Notifications
You must be signed in to change notification settings - Fork 13
82 lines (70 loc) · 2.74 KB
/
Copy pathsubmit_pr.yml
File metadata and controls
82 lines (70 loc) · 2.74 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Submit Article PR
permissions:
contents: write
pull-requests: write
on:
workflow_dispatch:
inputs:
submitterName:
description: "Name of the user proposing the change"
required: true
reviewerName:
description: "Name of the admin who approved it"
required: true
filePath:
description: "Path to the file to modify or create"
required: true
content:
description: "Content of the file"
required: true
title:
description: "Title of the PR"
required: true
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "26"
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Create or update file
run: |
mkdir -p $(dirname "${{ github.event.inputs.filePath }}")
echo "${{ github.event.inputs.content }}" > "assets/${{ github.event.inputs.filePath }}"
- name: Manage Contributor List
run: |
CONTRIBUTOR_FILE="assets/CONTRIBUTORS.md"
SUBMITTER="${{ github.event.inputs.submitterName }}"
if [ ! -f "$CONTRIBUTOR_FILE" ]; then
echo "# Contributors Database" > "$CONTRIBUTOR_FILE"
echo "" >> "$CONTRIBUTOR_FILE"
echo "A list of rebels who fed the database." >> "$CONTRIBUTOR_FILE"
echo "" >> "$CONTRIBUTOR_FILE"
fi
if ! grep -q "$SUBMITTER" "$CONTRIBUTOR_FILE"; then
echo "- $SUBMITTER" >> "$CONTRIBUTOR_FILE"
echo "Added $SUBMITTER to contributors list"
else
echo "$SUBMITTER already a contributor"
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "docs(assets): Update ${{ github.event.inputs.filePath }}"
title: "Content Update: ${{ github.event.inputs.title }} by ${{ github.event.inputs.submitterName }}"
body: |
## Automated Content Update 🚀
**Submitted by:** ${{ github.event.inputs.submitterName }}
**Approved by:** ${{ github.event.inputs.reviewerName }}
**Target File:** `assets/${{ github.event.inputs.filePath }}`
This PR was automatically generated after passing the review hub. If the submitter is new, they have been appended to `CONTRIBUTORS.md`.
Please review the changes and merge them to update the database.
branch: "update-content-${{ github.event.inputs.submitterName }}-${{ github.run_id }}"
base: main
delete-branch: true