forked from jeandeaual/warthog-config
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (45 loc) · 1.71 KB
/
update-description-topics.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
name: Update DockerHub description
on:
push:
branches:
- master
paths:
- Cargo.toml
- .github/workflows/update-description-topics.yml
jobs:
update-description-topics:
name: Update the repository description and topics
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Get the package name
id: package
run: |
cargo_metadata="$(cargo metadata --format-version 1)"
package_name="$(echo ${cargo_metadata} | jq -r '.workspace_members[0]' | cut -d' ' -f 1)"
echo "::set-output name=description::$(echo ${cargo_metadata} | jq -c '.packages[] | select(.name == "'"${package_name}"'") | .description')"
echo "::set-output name=keywords::$(echo ${cargo_metadata} | jq -c '.packages[] | select(.name == "'"${package_name}"'") | .keywords')"
- name: Update the description
uses: octokit/[email protected]
id: update_description
with:
route: PATCH /repos/{owner}/{repo}
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
description: ${{ steps.package.outputs.description }}
env:
GITHUB_TOKEN: ${{ secrets.EDIT_REPO_TOKEN }}
- name: Update the topics
uses: octokit/[email protected]
id: update_topics
with:
route: PUT /repos/{owner}/{repo}/topics
mediaType: |
previews:
- mercy
owner: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
names: ${{ steps.package.outputs.keywords }}
env:
GITHUB_TOKEN: ${{ secrets.EDIT_REPO_TOKEN }}