Fogejo Actions tests
This commit is contained in:
parent
d255395fc8
commit
7ccbeb7a46
34 changed files with 764 additions and 1 deletions
57
actions/example-pull-request/run.sh
Executable file
57
actions/example-pull-request/run.sh
Executable file
|
@ -0,0 +1,57 @@
|
|||
api=$url/api/v1
|
||||
export d=/srv/example-pull-request
|
||||
|
||||
PROOF='some proof'
|
||||
|
||||
function setup() {
|
||||
forgejo-test-helper.sh push_workflow actions/example-$example $url root example-$example setup-forgejo $token
|
||||
|
||||
forgejo-curl.sh api_json --data-raw '{"username":"fork-org"}' $api/orgs
|
||||
forgejo-curl.sh api_json --data-raw '{"organization":"fork-org"}' $api/repos/root/example-pull-request/forks
|
||||
forgejo-curl.sh api_json -X PUT --data-raw '{"data":"AAAA"}' $api/repos/root/example-pull-request/actions/secrets/SECRET
|
||||
|
||||
|
||||
(
|
||||
cd $d
|
||||
git clone $url/fork-org/example-pull-request fork
|
||||
cd fork
|
||||
git config user.email root@example.com
|
||||
git config user.name username
|
||||
echo fork $PROOF >> README
|
||||
git add .
|
||||
git commit -m 'fork change'
|
||||
git push
|
||||
)
|
||||
|
||||
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR from fork","base":"main","head":"fork-org:main"}' $api/repos/root/example-pull-request/pulls
|
||||
|
||||
(
|
||||
cd $d
|
||||
git clone $url/root/example-pull-request
|
||||
cd example-pull-request
|
||||
git checkout -b other
|
||||
git config user.email root@example.com
|
||||
git config user.name username
|
||||
echo other $PROOF >> README
|
||||
git add .
|
||||
git commit -m 'other change'
|
||||
git push --force -u origin other
|
||||
)
|
||||
|
||||
forgejo.sh retry forgejo-curl.sh api_json --data-raw '{"title":"PR same repo","base":"main","head":"other"}' $api/repos/root/example-pull-request/pulls
|
||||
|
||||
export RETRY_DELAYS="60 60 60 60 60 60 60"
|
||||
for assert in $EXAMPLE_DIR/assert-*.sh ; do
|
||||
if ! forgejo.sh retry $assert ; then
|
||||
find $d
|
||||
cat $FORGEJO_RUNNER_LOGS
|
||||
false
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function main() {
|
||||
setup
|
||||
}
|
||||
|
||||
main
|
Loading…
Add table
Reference in a new issue