Try using ElementBot for recording screenshots too (#641)
This commit is contained in:
parent
ed3171bffa
commit
d55b1d5fce
2 changed files with 40 additions and 6 deletions
4
.github/workflows/recordScreenshots.yml
vendored
4
.github/workflows/recordScreenshots.yml
vendored
|
|
@ -16,6 +16,7 @@ jobs:
|
||||||
- name: ⏬ Checkout with LFS
|
- name: ⏬ Checkout with LFS
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
persist-credentials: false
|
||||||
lfs: 'true'
|
lfs: 'true'
|
||||||
- name: ☕️ Use JDK 17
|
- name: ☕️ Use JDK 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
|
|
@ -30,5 +31,6 @@ jobs:
|
||||||
- name: Record screenshots
|
- name: Record screenshots
|
||||||
run: "./.github/workflows/scripts/recordScreenshots.sh"
|
run: "./.github/workflows/scripts/recordScreenshots.sh"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
|
||||||
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
|
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
|
||||||
|
|
||||||
|
|
|
||||||
42
.github/workflows/scripts/recordScreenshots.sh
vendored
42
.github/workflows/scripts/recordScreenshots.sh
vendored
|
|
@ -16,13 +16,43 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ -z ${GITHUB_TOKEN} ]]; then
|
TOKEN=$GITHUB_TOKEN
|
||||||
echo "Missing GITHUB_TOKEN variable"
|
REPO=$GITHUB_REPOSITORY
|
||||||
|
|
||||||
|
SHORT=t:,r:
|
||||||
|
LONG=token:,repo:
|
||||||
|
OPTS=$(getopt -a -n recordScreenshots --options $SHORT --longoptions $LONG -- "$@")
|
||||||
|
|
||||||
|
eval set -- "$OPTS"
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-t | --token )
|
||||||
|
TOKEN="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
-r | --repo )
|
||||||
|
REPO="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
shift;
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unexpected option: $1"
|
||||||
|
help
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z ${TOKEN} ]]; then
|
||||||
|
echo "No token specified, either set the env var GITHUB_TOKEN or use the --token option"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${GITHUB_REPOSITORY} ]]; then
|
if [[ -z ${REPO} ]]; then
|
||||||
echo "Missing GITHUB_REPOSITORY variable"
|
echo "No repo specified, either set the env var GITHUB_REPOSITORY or use the --repo option"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -35,6 +65,8 @@ git config user.email "benoitm+elementbot@element.io"
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Update screenshots"
|
git commit -m "Update screenshots"
|
||||||
|
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
|
||||||
echo "Pushing changes"
|
echo "Pushing changes"
|
||||||
git push "https://$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git"
|
git push "https://$TOKEN@github.com/$REPO.git" $BRANCH:refs/heads/$BRANCH
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue