skills / github-pages

Create a site or blog from your GitHub repositories with GitHub Pages.
MIT License
752 stars 198 forks source link

[Bug] Step 0 does not complete when creating a repository of the course from template #24

Closed shoraine closed 1 year ago

shoraine commented 1 year ago

Describe the bug Step 0 of the workflow which moves the course along does not complete. Due to insufficient permissions for GitHub Actions the initial commit gets stuck. This breaks the workflow and prevents the course from moving beyond step 0. Completion with pull request/merge is not possible.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://skills.github.com/
  2. Click on GitHub Pages (https://github.com/skills/github-pages)
  3. Click on 'Use this template'
  4. Right-click 'Create a new repository' and 'Open link in new tab'
  5. Repository name: 'github-pages', everything else left alone
  6. Click 'Create repository from template'
  7. Switch to 'my-pages' branch
  8. Notice README.md does not advance to Step 1
  9. Go to Actions tab
  10. Click on 'Step 0, Start' in the 'Actions' section
  11. Click on 'Initial commit' (red x) in the workflow view
  12. Click on 'On start' (red x) under '0-start.yml'
  13. Find error under 'Create my-pages branch, initial Pages files, and pull request'

Expected behavior Pull request is created and step 0 completes, advancing the course to step 1.

Screenshots 20230118_github_github-pages_bug

Device information

Additional context This appears to be a problem in other courses as well. See https://github.com/skills/communicate-using-markdown/issues/29.

vps-victor commented 1 year ago

Steps to fix (as an user)

1 - Go to settings and check the option to allow Actions create and accept pull-requests. 2 - Go go settings and allow the pages to the main branch (as the 'github-pages repo' step-1 says). 3 - Delete the my-pages branche if it was created. 4 - Clone the repo in your local machine. 5 - Update all the 'uses: actions/checkout@v2' in all the 5 files steps on the '.github/workflow/' to the current version of the checkout on marketplace:

- name: Checkout
  uses: actions/checkout@v3.3.0

6 - push all the code and keep your skills lab.

Investigating bugs root The thing that I notice after rerunning the (failed) job with debugger option was this error (Attempt#2): image (as something in the proccess create a branch and edit the main branch after and tried to push without pull before) I decide to delete 'my-pages' branch thinking that if this above happens, maybe branching from the main, it shows me a new error right after create it (Attempt#4): image _(the Github Actions wasn't allowed (by deafult) to create and approve pull requests. Github Documentation about it. So I enable it and rerun (Attempt#5), and again, I had to delete the 'my-pages' branch because it shows the same at (Attempt#2). At the Attempt#6 a new journey of the erros similar to Attempt#2 started, so I adopt a new strategy. After the attempt#6 give me some tips and after some searchs in google, I decided to change the checkout version in the workflow, all checkouts steps to v3.3.0 version, and it works very well after rerun the steps and follow the README steps.

sinsukehlab commented 1 year ago

The workflow 0-start.yml in the course skills/release-based-workflow also creates a pull request but it runs without errors. The restriction can probably be circumvented by running shell scripts (.github/script/*.sh) instead of running commands directly coded in YAML files (.github/workflows/*.yml).

sinsukehlab commented 1 year ago

The workflow 0-start.yml in the course skills/release-based-workflow also creates a pull request but it runs without errors. The restriction can probably be circumvented by running shell scripts (.github/script/*.sh) instead of running commands directly coded in YAML files (.github/workflows/*.yml).

@heiskr I would like to hear from you about this. I'm planning to open a PR to change the UNIX commands coded in YAML files into shell scripts.

heiskr commented 1 year ago

Oh, I didn't realize someone had added the closes tag to the pull request 😬

heiskr commented 1 year ago

We received guidance to remove all usage of gh pr create and gh pr review from the courses, so you'll probably be seeing pull requests from various folks at GitHub over the next week or two.

sinsukehlab commented 1 year ago

Noted. Then I will wait the updates.

sinsukehlab commented 1 year ago

@heiskr I wonder how you will change the review-pull-requests course, removing all usage of gh pr create.

sinsukehlab commented 1 year ago

The workflow 0-start.yml in the course skills/release-based-workflow also creates a pull request but it runs without errors. The restriction can probably be circumvented by running shell scripts (.github/script/*.sh) instead of running commands directly coded in YAML files (.github/workflows/*.yml).

Oh, the restriction cannot be circumvented by running shell scripts.

heiskr commented 1 year ago

We've updated this course to include

  1. (optional) Create a pull request to view all the changes you'll make throughout this course. Click the Pull Requests tab, click New pull request, set base: main and compare:my-pages.

and we've removed the usage of gh pr create. We are still working on the other courses, currently I believe we have 6 of 14 updated so far.

Thank you for bringing this issue to our attention.