pNm193 commented on PR #36:
URL: https://github.com/apache/attic/pull/36#issuecomment-4283816749
I'll help you find a solution for the failing job. Let me first retrieve the
job logs to understand what went wrong.Now let me retrieve the workflow file to
understand the job definition:## Solution for Job 71160390506
The job is failing with `fatal: invalid reference: social_media` at exit
code 128. This occurs in the "🚀 Add commit to the site staging *-site branch"
step (lines 99-139).
### Root Cause
The workflow attempts to switch to a branch named `social_media-site` (line
110), but the actual branch `social_media` doesn't exist as a remote-tracking
branch after the `git fetch` operation on line 109. The fetch command uses
`+refs/heads/*:refs/remotes/origin/*` which should create remote-tracking
branches, but the subsequent `git switch $SITE` fails because the branch
reference is invalid.
### Issue Analysis
Looking at the logs and workflow:
1. Line 109 fetches all remote branches with shallow depth (depth=1 from
checkout)
2. Line 110 attempts `git switch $SITE` where `$SITE = "social_media-site"`
3. The command fails because it's trying to switch to a branch that either:
- Doesn't exist remotely yet, or
- Wasn't properly fetched due to shallow clone limitations
### Recommended Fix
Replace line 109 in `.github/workflows/website.yml`:
```yaml
# Current (problematic):
git fetch --tags -- origin +refs/heads/*:refs/remotes/origin/*
# Suggested fix:
git fetch --tags --all origin
```
Or, more robustly, use a remote reference directly:
```yaml
if git switch -c $SITE origin/$BRANCH
then
echo "creating new $SITE from $BRANCH"
else
git switch $SITE
echo "updating existing $SITE"
fi
```
This approach:
- Explicitly creates the branch from the remote tracking branch
`origin/$BRANCH` if it doesn't exist locally
- Falls back to switching to the existing local branch
- Properly handles cases where the branch is being created for the first time
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]