@krx3d/tizentube2 1.30.700 → 1.30.720
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
name: Sync from GitHub
|
|
2
|
+
|
|
3
|
+
# Brings whatever changed on github.com/KrX3D/TizenTube into this mirror as a
|
|
4
|
+
# single pull request, and leaves that pull request to be reviewed and merged
|
|
5
|
+
# rather than writing to main itself.
|
|
6
|
+
#
|
|
7
|
+
# One pull request, not one per run: the sync branch is reused and force-moved
|
|
8
|
+
# to GitHub's current tip, and a run that finds the pull request already open
|
|
9
|
+
# updates the branch and says so instead of opening another.
|
|
10
|
+
#
|
|
11
|
+
# Lives in .gitea/workflows rather than .github/workflows deliberately. The
|
|
12
|
+
# second is synced from GitHub and holds that repository's own workflows —
|
|
13
|
+
# including the one that publishes to npm, which must never run here. See
|
|
14
|
+
# runs-on below for how that is kept from happening.
|
|
15
|
+
#
|
|
16
|
+
# It is nonetheless committed on GitHub as well, where it does nothing: GitHub
|
|
17
|
+
# Actions reads .github/workflows and only that, so this file is never parsed
|
|
18
|
+
# there and never appears in the Actions tab. It is here so that the mirror
|
|
19
|
+
# holds no commit GitHub lacks. When it lived only on the mirror, the mirror's
|
|
20
|
+
# main was permanently one commit ahead, so every sync was a real merge and
|
|
21
|
+
# left two more merge commits behind it. With the file on both sides the two
|
|
22
|
+
# branches are identical and each sync fast-forwards.
|
|
23
|
+
|
|
24
|
+
on:
|
|
25
|
+
schedule:
|
|
26
|
+
# Hourly, offset off the hour so it does not land with everything else.
|
|
27
|
+
- cron: '17 * * * *'
|
|
28
|
+
workflow_dispatch:
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
sync:
|
|
32
|
+
# Deliberately not ubuntu-latest. This repository carries the GitHub
|
|
33
|
+
# workflows too, and they all ask for ubuntu-latest — so a runner
|
|
34
|
+
# registered with this label alone can run this workflow and none of
|
|
35
|
+
# those. The Actions tab can also disable them one by one, which is worth
|
|
36
|
+
# doing as well; this is the part that holds without anyone remembering.
|
|
37
|
+
runs-on: gitea-sync
|
|
38
|
+
steps:
|
|
39
|
+
- name: Bring GitHub's changes onto the sync branch and open one pull request
|
|
40
|
+
env:
|
|
41
|
+
# A personal access token with write access to this repository.
|
|
42
|
+
# Falls back to the token Gitea Actions provides, which is enough to
|
|
43
|
+
# push but may not be allowed to open a pull request depending on the
|
|
44
|
+
# instance's settings — hence the preference.
|
|
45
|
+
SYNC_TOKEN: ${{ secrets.SYNC_TOKEN }}
|
|
46
|
+
AUTO_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
47
|
+
SERVER_URL: ${{ github.server_url }}
|
|
48
|
+
REPO: ${{ github.repository }}
|
|
49
|
+
SOURCE: https://github.com/KrX3D/TizenTube.git
|
|
50
|
+
SYNC_BRANCH: github-sync
|
|
51
|
+
BASE_BRANCH: main
|
|
52
|
+
run: |
|
|
53
|
+
set -eu
|
|
54
|
+
|
|
55
|
+
TOKEN="${SYNC_TOKEN:-${AUTO_TOKEN:-}}"
|
|
56
|
+
if [ -z "$TOKEN" ]; then
|
|
57
|
+
echo "No token available. Add a repository secret named SYNC_TOKEN"
|
|
58
|
+
echo "holding a personal access token with write access."
|
|
59
|
+
exit 1
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
# The scheme is kept rather than assumed: this instance is plain http
|
|
63
|
+
# today and may not be tomorrow.
|
|
64
|
+
case "$SERVER_URL" in
|
|
65
|
+
https://*) SCHEME=https; HOSTPART="${SERVER_URL#https://}" ;;
|
|
66
|
+
*) SCHEME=http; HOSTPART="${SERVER_URL#http://}" ;;
|
|
67
|
+
esac
|
|
68
|
+
HOSTPART="${HOSTPART%/}"
|
|
69
|
+
PUSH_URL="$SCHEME://$TOKEN@$HOSTPART/$REPO.git"
|
|
70
|
+
API="$SCHEME://$HOSTPART/api/v1/repos/$REPO"
|
|
71
|
+
|
|
72
|
+
# Only the base branch: this mirror carries 154 branches and cloning
|
|
73
|
+
# all of them to compare one would cost minutes per run.
|
|
74
|
+
git clone --quiet --single-branch --branch "$BASE_BRANCH" "$PUSH_URL" work
|
|
75
|
+
cd work
|
|
76
|
+
git config user.name "Gitea Actions"
|
|
77
|
+
git config user.email "actions@local"
|
|
78
|
+
|
|
79
|
+
git remote add github "$SOURCE"
|
|
80
|
+
git fetch --quiet --tags github "$BASE_BRANCH"
|
|
81
|
+
TIP=$(git rev-parse "github/$BASE_BRANCH")
|
|
82
|
+
echo "GitHub $BASE_BRANCH is at $TIP"
|
|
83
|
+
|
|
84
|
+
# Already contained: nothing changed since the last merge, so there is
|
|
85
|
+
# nothing to open a pull request about.
|
|
86
|
+
if git merge-base --is-ancestor "$TIP" "origin/$BASE_BRANCH"; then
|
|
87
|
+
echo "This mirror already contains it. Nothing to do."
|
|
88
|
+
exit 0
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
AHEAD=$(git rev-list --count "origin/$BASE_BRANCH..$TIP")
|
|
92
|
+
echo "$AHEAD commit(s) to bring over"
|
|
93
|
+
|
|
94
|
+
# Force, because the branch is a pointer at GitHub's tip and nothing
|
|
95
|
+
# else: anything that was on it has either been merged or superseded.
|
|
96
|
+
git push --quiet --force "$PUSH_URL" "$TIP:refs/heads/$SYNC_BRANCH"
|
|
97
|
+
# Tags come along for free and are worth having in a mirror.
|
|
98
|
+
git push --quiet --tags "$PUSH_URL" || echo "(tags unchanged or rejected, continuing)"
|
|
99
|
+
|
|
100
|
+
# One pull request: if one is already open from this branch, the push
|
|
101
|
+
# above has just updated it.
|
|
102
|
+
OPEN=$(curl -sf -H "Authorization: token $TOKEN" \
|
|
103
|
+
"$API/pulls?state=open&limit=50" \
|
|
104
|
+
| tr '}' '\n' | grep -c "\"ref\":\"$SYNC_BRANCH\"" || true)
|
|
105
|
+
if [ "${OPEN:-0}" -gt 0 ]; then
|
|
106
|
+
echo "A pull request from $SYNC_BRANCH is already open; its branch now points at $TIP."
|
|
107
|
+
exit 0
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
# The commit list goes in the body, escaped for JSON and joined with
|
|
111
|
+
# literal newline escapes so no multi-line quoting is needed.
|
|
112
|
+
LIST=$(git log --oneline --no-decorate "origin/$BASE_BRANCH..$TIP" \
|
|
113
|
+
| head -40 \
|
|
114
|
+
| sed 's/\\/\\\\/g; s/"/\\"/g' \
|
|
115
|
+
| sed ':a;N;$!ba;s/\n/\\n/g')
|
|
116
|
+
TITLE="Sync $AHEAD commit(s) from GitHub"
|
|
117
|
+
BODY="Brings $AHEAD commit(s) from github.com/KrX3D/TizenTube up to \`$TIP\`.\\n\\nThis mirror is a backup; merging keeps it current without touching GitHub.\\n\\n$LIST"
|
|
118
|
+
|
|
119
|
+
printf '{"head":"%s","base":"%s","title":"%s","body":"%s"}' \
|
|
120
|
+
"$SYNC_BRANCH" "$BASE_BRANCH" "$TITLE" "$BODY" > /tmp/pr.json
|
|
121
|
+
|
|
122
|
+
HTTP=$(curl -s -o /tmp/pr-out.json -w '%{http_code}' \
|
|
123
|
+
-X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
|
124
|
+
"$API/pulls" --data @/tmp/pr.json)
|
|
125
|
+
echo "create pull request -> HTTP $HTTP"
|
|
126
|
+
if [ "$HTTP" = "409" ]; then
|
|
127
|
+
echo "Gitea says such a pull request already exists; the branch is updated."
|
|
128
|
+
exit 0
|
|
129
|
+
fi
|
|
130
|
+
if [ "$HTTP" != "201" ]; then
|
|
131
|
+
head -c 400 /tmp/pr-out.json
|
|
132
|
+
echo
|
|
133
|
+
echo "The branch $SYNC_BRANCH is updated regardless; the pull request can be opened by hand."
|
|
134
|
+
exit 1
|
|
135
|
+
fi
|
|
136
|
+
echo "Opened a pull request for $AHEAD commit(s)."
|
|
@@ -82,6 +82,12 @@ on:
|
|
|
82
82
|
workflow_run:
|
|
83
83
|
workflows: ['Build, publish and cleanup old npm versions']
|
|
84
84
|
types: [completed]
|
|
85
|
+
# The branch the triggering run was on, which for a pull-request build is
|
|
86
|
+
# the feature branch. Without this, every pull request started a run here
|
|
87
|
+
# that the job-level `if` below immediately skipped: real runs, listed in
|
|
88
|
+
# the Actions tab, queued and accounted for, that could never do anything.
|
|
89
|
+
# Filtering at the trigger means they are never created.
|
|
90
|
+
branches: ['main']
|
|
85
91
|
push:
|
|
86
92
|
tags:
|
|
87
93
|
- 'v*.*.*'
|
|
@@ -100,8 +106,10 @@ jobs:
|
|
|
100
106
|
# Only proceed on a successful npm-publish run that was itself triggered by
|
|
101
107
|
# a push to main (build-publish-cleanup.yml's job is skipped entirely for
|
|
102
108
|
# pull_request runs, which can still report an overall "success" — checking
|
|
103
|
-
# .workflow_run.event too avoids firing off of those).
|
|
104
|
-
#
|
|
109
|
+
# .workflow_run.event too avoids firing off of those). The branches filter
|
|
110
|
+
# on the trigger now stops those runs from being created at all; this stays
|
|
111
|
+
# as the second check, since it also covers a publish run dispatched by
|
|
112
|
+
# hand off main. Tag pushes and manual dispatch always proceed.
|
|
105
113
|
if: >
|
|
106
114
|
github.event_name != 'workflow_run' ||
|
|
107
115
|
(github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push')
|
|
@@ -1,44 +1,55 @@
|
|
|
1
|
-
name: "CodeQL"
|
|
2
|
-
|
|
3
|
-
on:
|
|
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
|
-
|
|
1
|
+
name: "CodeQL"
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
# Pushes to main and the weekly sweep, but deliberately not pull_request.
|
|
5
|
+
#
|
|
6
|
+
# Every change arrives through a pull request that is then fast-forwarded
|
|
7
|
+
# onto main, so analysing both meant analysing the same tree twice: half of
|
|
8
|
+
# this repository's CodeQL runs were duplicates of the other half.
|
|
9
|
+
#
|
|
10
|
+
# Keeping the push side rather than the pull_request side is the deliberate
|
|
11
|
+
# half of that choice. Code scanning treats analyses of the default branch
|
|
12
|
+
# as the state of the project, which is what the Security tab lists and what
|
|
13
|
+
# gets fixed from; a pull_request-only setup leaves that state to the weekly
|
|
14
|
+
# cron. The cost is that a newly introduced alert shows up just after a merge
|
|
15
|
+
# instead of just before, which is how the alerts in this repository have
|
|
16
|
+
# actually been found and fixed.
|
|
17
|
+
push:
|
|
18
|
+
branches: ["main"]
|
|
19
|
+
schedule:
|
|
20
|
+
- cron: '23 3 * * 1'
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
analyze:
|
|
24
|
+
name: Analyze (${{ matrix.language }})
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
permissions:
|
|
27
|
+
actions: read
|
|
28
|
+
contents: read
|
|
29
|
+
security-events: write
|
|
30
|
+
|
|
31
|
+
strategy:
|
|
32
|
+
fail-fast: false
|
|
33
|
+
matrix:
|
|
34
|
+
language: ["javascript-typescript"]
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- name: Checkout repository
|
|
38
|
+
uses: actions/checkout@v6
|
|
39
|
+
|
|
40
|
+
- name: Initialize CodeQL
|
|
41
|
+
uses: github/codeql-action/init@v4
|
|
42
|
+
with:
|
|
43
|
+
languages: ${{ matrix.language }}
|
|
44
|
+
queries: security-extended,security-and-quality
|
|
45
|
+
config: |
|
|
46
|
+
paths-ignore:
|
|
47
|
+
- dist/**
|
|
48
|
+
|
|
49
|
+
- name: Autobuild
|
|
50
|
+
uses: github/codeql-action/autobuild@v4
|
|
51
|
+
|
|
52
|
+
- name: Perform CodeQL Analysis
|
|
53
|
+
uses: github/codeql-action/analyze@v4
|
|
54
|
+
with:
|
|
44
55
|
category: "/language:${{matrix.language}}"
|