Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools/ci/website_build.sh isn't safe to run locally #48946

Open
gsnedders opened this issue Nov 2, 2024 · 0 comments
Open

tools/ci/website_build.sh isn't safe to run locally #48946

gsnedders opened this issue Nov 2, 2024 · 0 comments

Comments

@gsnedders
Copy link
Member

Historically @jgraham has cared a lot about making it easy to replicate what CI does locally, and often suggested moving things into scripts so that they can be easily tested locally.

For one, it fails to actually fetch the current gh-pages branch, because environment variables aren't set:

remote_url=https://${DEPLOY_TOKEN}@github.com/${GITHUB_REPOSITORY}.git

And for another, it changes the global git config:

git config --global user.email "wpt-pr-bot@users.noreply.github.com"
git config --global user.name "wpt-pr-bot"

Before finally failing when it tries to read a file that doesn't exist:

function json_property {
cat ${1} | \
python -c "import json, sys; print(json.load(sys.stdin).get(\"${2}\", \"\"))"
}
function is_pull_request {
test -n "$(json_property ${GITHUB_EVENT_PATH} pull_request)"
}
function targets_master {
test $(json_property ${GITHUB_EVENT_PATH} ref) == 'refs/heads/master'
}

Maybe there will be some disagreement here, but it feels like a lot of these (especially the conditionals at the end!) should just be individual workflow steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant