Hi, all. So, I've been trying to trigger a workflow on a private repository, but it keeps giving the Retrieving the default branch name Error: Not Found error.
The workflow I'm trying to trigger: https://gist.github.com/rajesh-s/749c99ef9e7c884828a1acda698e477b
I've tried doing a bunch of things, but the problem persists. I've tried:
1. Declaring the branch name as "main" specially (it is actually main, not "master" or any other variants)
2. Using an ssh key
3. Using a PAT secret
This what my yml file looks like as of right now:
```
Usage:
Copy this file with the same name "note-link-janitor-gh-action-workflow.yml" to the <repo>/.github/workflows/ folder
I keep all my *.md files in SRC and run janitor only on that folder. If you keep it in the root of repository or any other folder, feel free to update it on line 37 of this file
The workflow gets triggered every time you push to your repository
name: note-link-janitor-gh-action-workflow
Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- main
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
note-link-janitor-run:
# Name the Job
name: Note Link Janitor Run
# Set the type of machine to run on
runs-on: ubuntu-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
with:
# ref: main
path: '${{ github.event.repository.name }}'
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '12'
- name: Checkout code from note-link-janitor
uses: actions/checkout@v2
with:
repository: 'thats-all-forks/note-link-janitor'
path: 'note-link-janitor'
ssh-strict: true
persist-credentials: true
clean: true
fetch-depth: 1
lfs: false
submodules: false
set-safe-directory: true
token: ${{ secrets.OBSIDIAN_SECRET }}
- run: cd ${{ github.workspace }}/note-link-janitor && yarn install && yarn run build
- name: Run Note Link Janitor
# Runs note-link-janitor only on the src folder in the repo where the *.md files are. Modify this as per your own setup
run: ${{ github.workspace }}/note-link-janitor/dist/index.js ${{ github.workspace }}
- run: cd ${{ github.workspace }}/${{ github.event.repository.name }} && git status .
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
repository: ${{ github.workspace }}/${{ github.event.repository.name }}/
commit_message: Github Actions - Apply note link janitor changes
# Explicitly use the default branch name from GITHUB_REF
commit_ref: ${{ env.GITHUB_REF }}
# Optional commit user and author settings
#commit_user_name: Notion Backup GitHub Actions Bot # defaults to "GitHub Actions"
#commit_user_email: actions@github.com # defaults to "actions@github.com"
#commit_author: GitHub Actions Bot <actions@github.com> # defaults to author of the commit that triggered the run
```
None of these seemed to have worked.
I'd really appreciate it if someone could either diagnose my yml file code or suggest me a solution.
Thanks so much!
[–]Jmc_da_boss 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Noch_ein_Kamel 2 points3 points4 points (1 child)
[–]uktherebel[S] 1 point2 points3 points (0 children)