-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (51 loc) · 2.42 KB
/
parse-new-experience.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
46
47
48
49
50
51
52
53
54
55
56
on:
issues:
types: [labeled]
name: Parse New Experience
jobs:
new_experience:
if: github.event.label.name == 'experience'
runs-on: ubuntu-latest
permissions:
issues: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: stefanbuck/github-issue-parser@v3
id: issue-parser
with:
template-path: .github/ISSUE_TEMPLATE/new_experience.yml
- run: echo '${{ steps.issue-parser.outputs.jsonString }}' > issue.json
- run: |
echo "experience_name=$(echo ${{ steps.issue-parser.outputs.issueparser_title }} | sed -e 's/[^[:alnum:]]/_/g' | tr -s '_' | tr A-Z a-z)" >> "$GITHUB_ENV"
echo "id=$(uuidgen)" >> "$GITHUB_ENV"
- run: |
jq '. + {"author": "${{ github.event.issue.user.login }}", "name": "${{ env.experience_name }}", "id": "${{ env.id }}"}' issue.json > tmp && mv tmp issue.json
- id: manifest-builder
run: |
node tools/prepare-experience.js
echo "test-manifest=anytype://main/import/?type=experience&source=https%3A%2F%2Fgithub.com%2Fanyproto%2Fgallery%2Fraw%2F${{ env.experience_name }}%2Fexperiences%2F${{ env.experience_name }}%2Ftest-manifest.json" >> "$GITHUB_ENV"
- run: rm issue.json
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: "Add preview for ${{ steps.issue-parser.outputs.issueparser_title }}"
committer: "Any Association <[email protected]>"
branch: ${{ env.experience_name }}
delete-branch: true
title: "Add experience ${{ steps.issue-parser.outputs.issueparser_title }}"
body: "Based on issue #${{ github.event.issue.number }}"
- name: Comment on Issue
run: gh issue comment "$NUMBER" --body "$BODY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: >
Thanks for your contribution! :tada:
I have created a pull request #${{ steps.cpr.outputs.pull-request-number }} based on data you provided.
If everything worked correctly, you can test the Experience:
[${{ env.test-manifest }}](${{ env.test-manifest }})
The Experience will be added to the Gallery after someone from the Any team reviews it.