forgejo/docs
31
58
Fork
You've already forked docs
249

add CI to preview PRs #5

Merged
earl-warren merged 1 commit from wip-ci into next 2023年08月16日 11:31:02 +02:00
Contributor
Copy link

TODO:

  • clone from website instead of caesar
  • skip the proof of change commit

Preview: https://forgejo.codeberg.page/@docs_pull_5/

This is a simplistic approach to get started with previews. It copies the website, moves the docs under /forgejo-docs/{{ base branch }}, create the website and publishes it for preview. No doubt the actual workflow will be different but that needs to be decided.

TODO: - [x] clone from website instead of caesar - [x] skip the proof of change commit Preview: https://forgejo.codeberg.page/@docs_pull_5/ This is a simplistic approach to get started with previews. It copies the website, moves the docs under `/forgejo-docs/{{ base branch }}`, create the website and publishes it for preview. No doubt the actual workflow will be different but that needs to be decided. * Added a WEBSITETOKEN secret created from the forgejo-website user. It is a token with write access to repositories. https://codeberg.org/forgejo/docs/settings/actions/secrets. Contrary to woodpecker it is not in an environment variable but will be replaced when inserting `${{ secrets.WEBSITETOKEN }}` somewhere * In the environment the variable was replaced CI_COMMIT_PULL_REQUEST → `${{ env.GITHUB_REF_NAME }}` * The preview is published at https://forgejo.codeberg.page/@docs_pull_N/ instead of https://forgejo.codeberg.page/@pull_N/ * The `$$` were replaced with `$` in the script because Forgejo Actions does not interpret `$` and therefore does not need escaping them to `$$`
Author
Contributor
Copy link

I forgot that secrets are not available to workflows running from pull requests from remote repositories. So... all PRs have to be from branches within the docs repository. That's not ideal but given that 99% of the contributions are from people with write access to the repository that should not be too much of a problem.

If someone contributes via a PR on a remote repository it can be dealt manually. That happened less than 10 times. This will change once the runner is more secure.

An alternative would be to stick to Woodpecker. But I'm not eager to keep maintaining the server/agents and all that entails. So I would rather live with this inconvenience than relying more on Woodpecker, unless it is absolutely necessary.

I forgot that secrets are not available to workflows running from pull requests from remote repositories. So... all PRs have to be from branches within the docs repository. That's not ideal but given that 99% of the contributions are from people with write access to the repository that should not be too much of a problem. If someone contributes via a PR on a remote repository it can be dealt manually. That happened less than 10 times. This **will change** once the runner is more secure. An alternative would be to stick to Woodpecker. But I'm not eager to keep maintaining the server/agents and all that entails. So I would rather live with this inconvenience than relying more on Woodpecker, unless it is absolutely necessary.

I feel very strongly that it is important for anyone with any level of involvement with the project to be able to easily send documentation pull requests. In general, I feel we should be lowering the barrier to entry for contributing to the docs at all costs. That was one of the main reasons I wanted this in a separate repo in the first place. It'll also make a mess of the branches in this repo. I suppose the previews aren't as important here as they are for the website repo, most of the content is textual and we should be able to get an idea of what it'll look like by checking the markdown preview in Forgejo. I'm rambling on, this is just a bit disappointing.

I see three potential paths forward

  • Proceed with this strategy
    • Add a check to skip the preview upload if the secret isn't available
  • Don't worry about previews for now
  • Use Woodpecker until we have a more secure runner that can handle this situation more gracefully

I'm somewhat indifferent. I wouldn't mind personally putting in some extra effort to adopt the latter strategy, but if others are strongly opposed to it, I'll let it go.

I feel very strongly that it is important for anyone with any level of involvement with the project to be able to easily send documentation pull requests. In general, I feel we should be lowering the barrier to entry for contributing to the docs at all costs. That was one of the main reasons I wanted this in a separate repo in the first place. It'll also make a mess of the branches in this repo. I suppose the previews aren't as important here as they are for the website repo, most of the content is textual and we should be able to get an idea of what it'll look like by checking the markdown preview in Forgejo. I'm rambling on, this is just a bit disappointing. I see three potential paths forward - Proceed with this strategy - Add a check to skip the preview upload if the secret isn't available - Don't worry about previews for now - Use Woodpecker until we have a more secure runner that can handle this situation more gracefully I'm somewhat indifferent. I wouldn't mind personally putting in some extra effort to adopt the latter strategy, but if others are strongly opposed to it, I'll let it go.
Author
Contributor
Copy link

I feel very strongly that it is important for anyone with any level of involvement with the project to be able to easily send documentation pull requests.

I agree and I'm quite unhappy that I did not see this problem coming although it was under my nose the whole time.

Proceed with this strategy

  • Add a check to skip the preview upload if the secret isn't available

And fix Forgejo Actions to make it possible. I think that's the only path forward because Forgejo Actions users will face the same situation. It's one of the unpleasant side effect of dogfooding: when something goes wrong, it stings.

Use Woodpecker until we have a more secure runner that can handle this situation more gracefully

I strongly feel that is a last resort, if it is entirely impossible to use Forgejo Actions for some reason.

> I feel very strongly that it is important for anyone with any level of involvement with the project to be able to easily send documentation pull requests. I agree and I'm quite unhappy that I did not see this problem coming although it was under my nose the whole time. > Proceed with this strategy > * Add a check to skip the preview upload if the secret isn't available And fix Forgejo Actions to make it possible. I think that's the only path forward because Forgejo Actions users will face the same situation. It's one of the unpleasant side effect of dogfooding: when something goes wrong, it stings. > Use Woodpecker until we have a more secure runner that can handle this situation more gracefully I strongly feel that is a last resort, if it is entirely impossible to use Forgejo Actions for some reason.

And fix Forgejo Actions to make it possible. I think that's the only path forward because Forgejo Actions users will face the same situation. It's one of the unpleasant side effect of dogfooding: when something goes wrong, it stings.

Well, yes, of course. I kind of took for granted that this needs to be fixed eventually.

> And fix Forgejo Actions to make it possible. I think that's the only path forward because Forgejo Actions users will face the same situation. It's one of the unpleasant side effect of dogfooding: when something goes wrong, it stings. Well, yes, of course. I kind of took for granted that this needs to be fixed eventually.

I'm unhappy about that situation. But I also agree that, as active Forgejo contributors, it is better to use Forgejo Actions with all the inconveniences that come with it rather than use another CI.

I'm unhappy about that situation. But I also agree that, as active Forgejo contributors, it is better to use Forgejo Actions with all the inconveniences that come with it rather than use another CI.
Member
Copy link

Well, I'm glad I asked for help instead of trying to sort it out myself 😀

I have to say I'm not a fan of having to use branches in this repo for PRs, for all the reasons @crystal articulated. In addition to the extra friction for contributors, I'm particularly not a fan of the mess of having extra branches in this repo. Perhaps we can agree on a branch prefix we will all use, such as pr/.

But if it's an interim solution until Forgejo Actions can be improved to support PRs from other repos, I guess we can put up with that for now for the sake of dogfooding.

Well, I'm glad I asked for help instead of trying to sort it out myself 😀 I have to say I'm not a fan of having to use branches in this repo for PRs, for all the reasons @crystal articulated. In addition to the extra friction for contributors, I'm particularly not a fan of the mess of having extra branches in this repo. Perhaps we can agree on a branch prefix we will all use, such as `pr/`. But if it's an interim solution until Forgejo Actions can be improved to support PRs from other repos, I guess we can put up with that for now for the sake of dogfooding.
@ -0,0 +14,4 @@
run:|
git clone --depth 1 https://codeberg.org/forgejo/website /tmp/website
mkdir -p /tmp/website/src/content/docs/next
cp -a * /tmp/website/src/content/docs/next
Member
Copy link

I think it would be better to copy the whole docs repo content to /tmp/website/forgejo-docs/next/, which is where the git submodule is normally.
The website repo has symlinks from src/content/docs/next/ to forgejo-docs/next/docs/ and from src/public/images/next/ to forgejo-docs/next/images/.

How do we handle the different version branches? Does each branch just have this config file with the appropriate versioned path here?

I think it would be better to copy the whole docs repo content to `/tmp/website/forgejo-docs/next/`, which is where the git submodule is normally. The website repo has symlinks from `src/content/docs/next/` to `forgejo-docs/next/docs/` and from `src/public/images/next/` to `forgejo-docs/next/images/`. How do we handle the different version branches? Does each branch just have this config file with the appropriate versioned path here?
Author
Contributor
Copy link

The workflow configuration now uses forgejo-docs/${{ env.GITHUB_BASE_REF }} instead of forgejo-docs/next

Would that work?

The workflow configuration now uses `forgejo-docs/${{ env.GITHUB_BASE_REF }}` instead of `forgejo-docs/next` Would that work?
Member
Copy link

Perfect.

Perfect.
caesar marked this conversation as resolved
earl-warren force-pushed wip-ci from 7f882f2de6
All checks were successful
pr / preview (pull_request) Successful in 35s
to b653dbefda
All checks were successful
pr / preview (pull_request) Successful in 19s
2023年08月16日 07:13:03 +02:00
Compare
Author
Contributor
Copy link

Added conditional preview (ignored if secrets is not available) and a PR to verify that #7

image

Added conditional preview (ignored if secrets is not available) and a PR to verify that https://codeberg.org/forgejo/docs/pulls/7 ![image](/attachments/8ba4d86b-0990-4e0b-9a64-f24b0970fcd6)
Author
Contributor
Copy link

But if it's an interim solution until Forgejo Actions can be improved to support PRs from other repos, I guess we can put up with that for now for the sake of dogfooding.

Thanks for your understanding. I realize it is an inconvenience and I'm hoping that won't last too long.

I'm particularly not a fan of the mess of having extra branches in this repo.

image

"Delete PR branch from PR" was set (it is not by default) to help mitigate the proliferation.

> But if it's an interim solution until Forgejo Actions can be improved to support PRs from other repos, I guess we can put up with that for now for the sake of dogfooding. Thanks for your understanding. I realize it is an inconvenience and I'm hoping that won't last too long. > I'm particularly not a fan of the mess of having extra branches in this repo. ![image](/attachments/2bcce3d9-4e6f-4142-aee0-b4b17aea2dba) "Delete PR branch from PR" was set (it is not by default) to help mitigate the proliferation.
Author
Contributor
Copy link

The preview shows the proof of change https://forgejo.codeberg.page/@docs_pull_5/docs/next/

image

The preview shows the proof of change https://forgejo.codeberg.page/@docs_pull_5/docs/next/ ![image](/attachments/88464909-d2c9-4426-8f9f-69afe020d0c5)
Ghost approved these changes 2023年08月16日 08:49:57 +02:00
caesar left a comment
Copy link

Looking good!

Looking good!
@ -0,0 +7,4 @@
preview:
runs-on:docker
container:
image:node:19
Member
Copy link

Can we use node v20 here? (I was going to send a PR to update it on the website repo too).

Can we use node v20 here? (I was going to send a PR to update it on the website repo too).
earl-warren marked this conversation as resolved
@ -0,0 +13,4 @@
- name:get forgejo.org and move the docs
run:|
#git clone --depth 1 https://codeberg.org/forgejo/website /tmp/website
git clone --recursive --depth 1 --branch docs-submodules https://codeberg.org/caesar/forgejo-website/ /tmp/website
Member
Copy link

Don't forget to change this (forgejo/website#331 is merged now)

Don't forget to change this (https://codeberg.org/forgejo/website/pulls/331 is merged now)
earl-warren marked this conversation as resolved
@ -0,0 +27,4 @@
cd /tmp/website
corepack enable
pnpm run format-ci
pnpm run lint:eslint
Member
Copy link

This is good for now. Later I'd like to add linting directly to this repo instead of linting the whole website.

This is good for now. Later I'd like to add linting directly to this repo instead of linting the whole website.
earl-warren marked this conversation as resolved
docs/index.md Outdated
@ -1,5 +1,5 @@
---
title: 'Forgejo v1.21 documentation'
title: 'OOOOOOOOOOOOO v1.21 documentation'
Member
Copy link

Don't forget to revert 😀

Don't forget to revert 😀
earl-warren marked this conversation as resolved
earl-warren force-pushed wip-ci from 0354a01d67
All checks were successful
pr / preview (pull_request) Successful in 38s
to 6452beaeb5
Some checks failed
pr / preview (pull_request) Failing after 3s
2023年08月16日 11:20:35 +02:00
Compare
earl-warren force-pushed wip-ci from 6452beaeb5
Some checks failed
pr / preview (pull_request) Failing after 3s
to a5e1a80b9c
Some checks failed
pr / preview (pull_request) Failing after 45s
2023年08月16日 11:22:22 +02:00
Compare
earl-warren force-pushed wip-ci from a5e1a80b9c
Some checks failed
pr / preview (pull_request) Failing after 45s
to 8694439911
All checks were successful
pr / preview (pull_request) Successful in 36s
2023年08月16日 11:24:20 +02:00
Compare
earl-warren force-pushed wip-ci from 8694439911
All checks were successful
pr / preview (pull_request) Successful in 36s
to ac85012cd0
All checks were successful
pr / preview (pull_request) Successful in 34s
2023年08月16日 11:25:58 +02:00
Compare
earl-warren force-pushed wip-ci from ac85012cd0
All checks were successful
pr / preview (pull_request) Successful in 34s
to ecd125d432
All checks were successful
pr / preview (pull_request) Successful in 39s
2023年08月16日 11:26:46 +02:00
Compare
earl-warren referenced this pull request from a commit 2023年08月16日 11:31:03 +02:00
crystal referenced this pull request from a commit 2023年08月16日 23:34:44 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
404
Broken links or missing content
backport/v1.19
Changes which should be backported to the v1.19 docs

Archived

backport/v1.20
Changes which should be backported to the v1.20 docs

Archived

backport/v1.21
Changes which should be backported to the v1.21 docs

Archived

backport/v10.0
Automated backport to v10.0

Archived

backport/v11.0
Automated backport to v11.0
backport/v12.0
Automated backport to v12.0

Archived

backport/v13.0
Automated backport to v13.0

Archived

backport/v14.0
Automated backport to v14.0

Archived

backport/v15.0
Automated backport to v15.0
backport/v16.0
Automated backport to v16.0
backport/v7.0
Automated backport to the v7.0 docs

Archived

backport/v8.0
Automated backport to the v8.0 docs

Archived

backport/v9.0
Automated backport to the v9.0 docs

Archived

good first issue
This issue is suitable for "drive-by contributors" wanting to contribute for the first time, and fixing it should be straightforward.
meta
Tooling and processes for maintaining the docs
new docs
Content to be added to the documentation

Archived

User research - Accessibility
Requires input about accessibility features, likely involves user testing.
User research - Blocked
Do not pick as-is! We are happy if you can help, but please coordinate with ongoing redesign in this area.
User research - Community
Community features, such as discovering other people's work or otherwise feeling welcome on a Forgejo instance.
User research - Config (instance)
Instance-wide configuration, authentication and other admin-only needs.
User research - Errors
How to deal with errors in the application and write helpful error messages.
User research - Filters
How filter and search is being worked with.
User research - Future backlog
The issue might be inspiring for future design work.
User research - Git workflow
AGit, fork-based and new Git workflow, PR creation etc
User research - Labels
Active research about Labels
User research - Moderation
Moderation Featuers for Admins are undergoing active User Research
User research - Needs input
Use this label to let the User Research team know their input is requested.
User research - Notifications/Dashboard
Research on how users should know what to do next.
User research - Rendering
Text rendering, markup languages etc
User research - Repo creation
Active research about the New Repo dialog.
User research - Repo units
The repo sections, disabling them and the "Add more" button.
User research - Security
User research - Settings (in-app)
How to structure in-app settings in the future?
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/docs!5
Reference in a new issue
forgejo/docs
No description provided.
Delete branch "wip-ci"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?