mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 05:31:00 -05:00
59 lines
1.7 KiB
Bash
59 lines
1.7 KiB
Bash
|
url=http://root:admin1234@$(cat forgejo-ip):3000
|
||
|
api=$url/api/v1
|
||
|
export d=/srv/example-pull-request
|
||
|
|
||
|
PROOF='some proof'
|
||
|
|
||
|
function setup() {
|
||
|
forgejo-test-helper.sh push_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat 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
|