1
+ name : update-changesets
2
+
3
+ env :
4
+ WORKFLOW_FILE : update-changesets.yml
5
+ CHANGESETS_FILE : changesets
6
+ RSS_URLS : |
7
+ https://unity.com/releases/editor/lts-releases.xml
8
+ https://unity.com/releases/editor/tech-and-preview-releases.xml
9
+ https://unity.com/releases/editor/beta-releases.xml
10
+ https://unity.com/releases/editor/alpha-releases.xml
11
+ REGEX_UNITY_VERSION : ' [0-9]{4,}\.[0-9]{1,}\.[0-9]{1,}(a|b|f|rc|p)[0-9]{1,}'
12
+
13
+ on :
14
+ issue_comment :
15
+ types :
16
+ - created
17
+
18
+ jobs :
19
+ build :
20
+ if : startsWith(github.event.comment.body, '/update-changesets') && github.event.issue.locked
21
+ name : 🛠️ Update changesets
22
+ runs-on : ubuntu-latest
23
+ permissions :
24
+ contents : write
25
+ actions : read
26
+ steps :
27
+ - name : 🚚 Checkout (gh_pages)
28
+ uses : actions/checkout@v4
29
+ with :
30
+ fetch-depth : 0
31
+ ref : gh_pages
32
+ - name : 🔍 Check other workflows
33
+ run : |
34
+ # Get in-progress or queued workflows.
35
+ gh auth login --with-token < <(echo ${{ github.token }})
36
+ RESULT=`gh run list --workflow ${{ env.WORKFLOW_FILE }} --json status --jq '[.[] | select(.status == "in_progress")] | length == 1'`
37
+
38
+ # [ERROR] Other workflows are in progress.
39
+ [ "$RESULT" = "false" ] && echo "::error::Other '${{ env.WORKFLOW_FILE }}' workflows are in progress." && exit 1 || :
40
+
41
+ - name : 🛠️ Update changesets file
42
+ run : |
43
+ touch "${{ env.CHANGESETS_FILE }}"
44
+ urls=(`echo "${{ env.RSS_URLS }}"`)
45
+ for url in "${urls[@]}"; do
46
+ # Find versions from RSS
47
+ echo "Processing: $url" | tee -a $GITHUB_STEP_SUMMARY
48
+ versions=($(curl -s "$url" | grep -oE "${{ env.REGEX_UNITY_VERSION }}" | sort -u))
49
+
50
+ for version in "${versions[@]}"; do
51
+ # Already exists
52
+ if grep -q "$version" "${{ env.CHANGESETS_FILE }}"; then
53
+ continue
54
+ fi
55
+
56
+ # Get changeset for the Unity version
57
+ changeset_output=$(npx unity-changeset "$version" 2>/dev/null)
58
+
59
+ if [ $? -eq 0 ]; then
60
+ echo -e "$version\t$changeset_output" | tee -a "${{ env.CHANGESETS_FILE }}" $GITHUB_STEP_SUMMARY
61
+ else
62
+ echo " Error: $version is not valid"
63
+ fi
64
+ done
65
+ done
66
+
67
+ - name : Commit & Push changes
68
+ uses : actions-js/push@master
69
+ with :
70
+ github_token : ${{ github.token }}
71
+ amend : true
72
+ force : true
73
+ branch : gh_pages
0 commit comments