Skip to content

Commit

Permalink
Fix branch update permissions errors (#79)
Browse files Browse the repository at this point in the history
* Testing trying old PAT

* Try old author

* Actually swap to old token in .NET

* Try new author

* Undo unnecessary Go changes

* Do not try to switch to branch before fetching

* Add logic to check if remote branch exists, not local branch

* Make same branch changes for Go build
  • Loading branch information
kfcampbell authored Jul 26, 2024
1 parent b93f265 commit 73e17cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/build-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ jobs:
- name: Run scripts/generate-dotnet.sh
run: scripts/generate-dotnet.sh ${{ matrix.platform }}

- name: Clean up build artifacts before syncing
run: dotnet clean stage/dotnet/$REPO_NAME/GitHub.Octokit.sln

- name: Clone the existing repository
run: |
cd ../
git clone https://github.com/octokit/$REPO_NAME.git
- name: Copy generated code to dotnet-sdk
run: |
run: |
cp -rf stage/dotnet/$REPO_NAME/. ../$REPO_NAME/ # copy everything
rsync -av --delete stage/dotnet/$REPO_NAME/src/ ../$REPO_NAME/src/ # delete files that are not generated
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:

- name: Run scripts/generate-dotnet.sh
run: scripts/generate-dotnet.sh ghes ${{ matrix.version }}

- name: Clean up build artifacts before syncing
run: dotnet clean stage/dotnet/dotnet-sdk-enterprise-server/GitHub.Octokit.sln

Expand All @@ -97,10 +97,14 @@ jobs:
cd ../
git clone https://github.com/octokit/dotnet-sdk-enterprise-server.git
cd dotnet-sdk-enterprise-server
if git show-ref --verify --quiet refs/heads/${{ matrix.version }}; then
git switch ${{ matrix.version }}
git fetch origin
if git show-ref --verify --quiet refs/remotes/origin/${{ matrix.version }}; then
git switch -c ${{ matrix.version }} --track origin/${{ matrix.version }}
echo "Branch ${{ matrix.version }} already exists; skipping creation and fetching from remote"
else
git switch -c ${{ matrix.version }}
echo "Branch ${{ matrix.version }} does not exist on remote; created locally"
git switch -
fi
cd ../
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ jobs:
cd ../
git clone https://github.com/octokit/go-sdk-enterprise-server.git
cd go-sdk-enterprise-server
if git show-ref --verify --quiet refs/heads/${{ matrix.version }}; then
git switch ${{ matrix.version }}
if git show-ref --verify --quiet refs/remotes/origin/${{ matrix.version }}; then
git switch -c ${{ matrix.version }} --track origin/${{ matrix.version }}
echo "Branch ${{ matrix.version }} already exists; skipping creation and fetching from remote"
else
git switch -c ${{ matrix.version }}
echo "Branch ${{ matrix.version }} does not exist on remote; created locally"
git switch -
fi
cd ../
Expand Down

0 comments on commit 73e17cf

Please sign in to comment.