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

Update UG GitHub Actions deployment sample workflow file #2555

Closed
gerteck opened this issue Jun 11, 2024 · 3 comments · Fixed by #2556
Closed

Update UG GitHub Actions deployment sample workflow file #2555

gerteck opened this issue Jun 11, 2024 · 3 comments · Fixed by #2556
Assignees

Comments

@gerteck
Copy link
Contributor

gerteck commented Jun 11, 2024

Please confirm that you have searched existing issues in the repo

Yes, I have searched the existing issues

Any related issues?

No response

Tell us about your environment

Windows 11

MarkBind version

5.5.2

Describe the bug and the steps to reproduce it

While exploring MarkBind as a User, I was following the UG to deploy via GitHub Actions to deploy my site on GitHub Pages for a newly set up repository. As the workflow permissions default to read-only (Settings>Actions>General), github-actions is not able to write to gh-pages.

Steps to reproduce

  1. Init new repo for new Markbind site
  2. Use template workflow file
  3. push to github for deployment

Bug/Nit description

Default GitHub Token Permissions:

GITHUB_TOKEN Permissions
  Contents: read
  Metadata: read
  Packages: read

Error 403 Forbidden:

info: Build success!
error: uncaughtException: remote: Permission to gerteck/repo-name/git denied to github-actions[bot].
fatal: unable to access 'https://github.com/user-name/repo-name.git/': The requested URL returned error: 403
ProcessError: remote: Permission to gerteck/mb-dev.git denied to github-actions[bot].

Proposed changes to UG:

name: Deploy MarkBind Site
on:
  push:
    branches: master

jobs:
  build:
    runs-on: ubuntu-latest
    name: test
+    permissions: 
+      contents: write
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '16'
      - run: npm i -g markbind-cli
      - run: markbind deploy --ci

Additionally, workflow reports success when the deployment can be considered to be erroneous, which has been raised in #1863.

While I don't think it is a big bug, perhaps a nit, but I think it would help to improve the onboarding process and make it easier for users to get started with MarkBind until they are more familiar configuring their own workflow.

Expected behavior

Deployment on github pages success:

info: Build success!
info: The website has been deployed at: https://user.github.io/repo-name

Anything else?

No response

@gerteck
Copy link
Contributor Author

gerteck commented Jun 11, 2024

Additionally, perhaps changing the branch default master to the default main too could be a low hanging fruit.

@Tim-Siu Tim-Siu self-assigned this Jun 12, 2024
@Tim-Siu

This comment was marked as off-topic.

@Tim-Siu
Copy link
Contributor

Tim-Siu commented Jun 12, 2024

Hi @gerteck ,

Thank you for finding out this issue! Indeed they are some gaps in the documentation.

I tried your solution and it worked great! It should be able to help users onboard MarkBind smoother.

But I some how need to manually select deploy from branch to have the markbind site deployed. There was no error from the CI-run log. Maybe this is related to #2547 and gh-pages error?

Anyway, you can submit a Pull Request for your findings and earn credits. The change from master to main looks appropriate to me as well.

Thank you for your work!

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