3838permissions :
3939 contents : write
4040 packages : read
41+ pull-requests : write
4142
4243env :
4344 NORMALIZED_VERSION : " "
8788 uses : actions/checkout@v4
8889 with :
8990 path : ./package-repo
90- token : ${{secrets.GITHUB_TOKEN}}
9191 fetch-depth : 0
9292
9393 - name : Authenticate with GitHub
@@ -180,8 +180,7 @@ jobs:
180180
181181 # Override the global extraheader set by actions/checkout (GITHUB_TOKEN) which would otherwise
182182 # take precedence over the credentials embedded in the URL and prevent access to external repos.
183- # if ! git -c http.https://github.com/.extraheader="" fetch upstream-source "+refs/tags/*:refs/tags/*"; then
184- if ! git fetch upstream-source "+refs/tags/*:refs/tags/*"; then
183+ if ! git -c http.https://github.com/.extraheader="" fetch upstream-source "+refs/tags/*:refs/tags/*"; then
185184 echo "❌ Failed to fetch tags from '${{inputs.upstream-repo}}'."
186185
187186 if [ -n "${{secrets.UPSTREAM_REPO_READ_PAT}}" ]; then
@@ -202,7 +201,7 @@ jobs:
202201 exit 1
203202 fi
204203
205- - name : Pre-populate the upstream/latest branch if first promotion
204+ - name : Merge upstream tag into upstream/latest
206205 working-directory : ./package-repo
207206 run : |
208207
@@ -214,7 +213,24 @@ jobs:
214213 else
215214 # The branch exists, check it out and promote it to the upstream tag
216215 git checkout upstream/latest
217- git merge --ff-only ${{inputs.upstream-tag}}
216+ git merge ${{inputs.upstream-tag}}
217+ fi
218+
219+ - name : Strip .github/workflows from upstream/latest
220+ working-directory : ./package-repo
221+ run : |
222+ # Since Github does not allow pushing workflows using the GITHUB_TOKEN, remove .github/workflows if present.
223+
224+ git config user.name "${{vars.DEB_PKG_BOT_CI_NAME}}"
225+ git config user.email "${{vars.DEB_PKG_BOT_CI_EMAIL}}"
226+
227+ git checkout upstream/latest
228+
229+ # Remove .github/workflows/ if present to avoid GITHUB_TOKEN push restrictions.
230+ # The upstream source repo workflows are not relevant to the packaging repo.
231+ if [ -d .github/workflows ]; then
232+ git rm -rf .github/workflows
233+ git commit -s -m "Remove .github/workflows from upstream source"
218234 fi
219235
220236 - name : Merge upstream tag into packaging branch
@@ -263,6 +279,8 @@ jobs:
263279 - name : Open Promotion PR
264280 working-directory : ./package-repo
265281 run : |
282+ gh auth login --with-token <<< "${{secrets.GITHUB_TOKEN}}"
283+
266284 ../qcom-build-utils/scripts/create_promotion_pr.py \
267285 --base-branch "${{inputs.debian-branch}}" \
268286 --upstream-tag "${{inputs.upstream-tag}}" \
0 commit comments