-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (41 loc) · 1.44 KB
/
gh-repo-update.yml
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
# Requires repo secret: PERSONAL_ACCESS_TOKEN with permissions:
# Administration: read and write
name: GitHub Repository Update
on:
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
repo-update:
runs-on: ubuntu-latest
permissions:
repository-projects: write
steps:
- uses: actions/checkout@v4
- run: |
DATA=$(jq --raw-output --compact-output '{description: .description, homepage: .homepage}' package.json)
curl \
--fail-with-body \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}" \
-d "${DATA}"
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- run: |
DATA=$(jq --raw-output --compact-output '{names: .keywords}' package.json)
curl \
--fail-with-body \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${PERSONAL_ACCESS_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/topics" \
-d "${DATA}"
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}