PR can be opened during the export
This commit is contained in:
parent
18246ed617
commit
b2d0870fa1
|
|
@ -23,13 +23,24 @@ jobs:
|
||||||
sudo apt-get -y install restic
|
sudo apt-get -y install restic
|
||||||
- name: Trigger backup export
|
- name: Trigger backup export
|
||||||
run: |
|
run: |
|
||||||
|
# needed for sanity check
|
||||||
|
NUMBER=$(gh api \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer $GH_TOKEN" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" repos/$REPO/pulls --jq '.[0].number')
|
||||||
|
TITLE=$(gh api \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer $GH_TOKEN" \
|
||||||
|
-H "X-GitHub-Api-Version: 2022-11-28" repos/$REPO/pulls --jq '.[0].title')
|
||||||
ID=$(gh api --method POST /user/migrations \
|
ID=$(gh api --method POST /user/migrations \
|
||||||
--raw-field "repositories[]=$REPO" \
|
--raw-field "repositories[]=$REPO" \
|
||||||
--field lock_repositories=false \
|
--field lock_repositories=false \
|
||||||
--field exclude_git_data=true --jq '.id')
|
--field exclude_git_data=true --jq '.id')
|
||||||
# define some ENV vars needed below
|
# define some ENV vars needed below
|
||||||
|
echo "LATEST_PR_NUMBER=$NUMBER" >>$GITHUB_ENV
|
||||||
|
echo "LATEST_PR_TITLE=$TITLE" >>$GITHUB_ENV
|
||||||
echo "EXPORT_ID=$ID" >>$GITHUB_ENV
|
echo "EXPORT_ID=$ID" >>$GITHUB_ENV
|
||||||
echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV
|
echo "REPO_NAME=${{ github.event.repository.name }}" >>$GITHUB_ENV
|
||||||
- name: Wait until backup is finished
|
- name: Wait until backup is finished
|
||||||
run: |
|
run: |
|
||||||
while true; do
|
while true; do
|
||||||
|
|
@ -46,12 +57,12 @@ jobs:
|
||||||
-o "archive.tgz" "$ARCHIVE_URL"
|
-o "archive.tgz" "$ARCHIVE_URL"
|
||||||
- name: Sanity check
|
- name: Sanity check
|
||||||
run: |
|
run: |
|
||||||
TITLE_LATEST_PR=$(gh api \
|
# Make sure that we have the latest PR information
|
||||||
-H "Accept: application/vnd.github+json" \
|
# title and corresponding number (from URL)
|
||||||
-H "Authorization: Bearer $GH_TOKEN" \
|
zgrep -a -B3 "$LATEST_PR_TITLE" archive.tgz |
|
||||||
-H "X-GitHub-Api-Version: 2022-11-28" repos/$REPO/pulls --jq '.[0].title')
|
grep "\"url\":" |
|
||||||
zgrep -a -B3 "$TITLE_LATEST_PR" archive.tgz || {
|
grep -q "https://github.com/$REPO/pull/$LATEST_PR_NUMBER" || {
|
||||||
echo "Latest PR title not found in archive.tgz"
|
echo "Latest PR not found in archive.tgz"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
- name: Save backup (restic)
|
- name: Save backup (restic)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue