Skip to content

Commit ae85e9f

Browse files
test
Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
1 parent 01d0e20 commit ae85e9f

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/qcom-promote-upstream-reusable-workflow.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ jobs:
8787
uses: actions/checkout@v4
8888
with:
8989
path: ./package-repo
90-
token: ${{secrets.GITHUB_TOKEN}}
9190
fetch-depth: 0
9291

9392
- name: Authenticate with GitHub
@@ -180,8 +179,7 @@ jobs:
180179
181180
# Override the global extraheader set by actions/checkout (GITHUB_TOKEN) which would otherwise
182181
# 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
182+
if ! git -c http.https://github.com/.extraheader="" fetch upstream-source "+refs/tags/*:refs/tags/*"; then
185183
echo "❌ Failed to fetch tags from '${{inputs.upstream-repo}}'."
186184
187185
if [ -n "${{secrets.UPSTREAM_REPO_READ_PAT}}" ]; then
@@ -202,7 +200,7 @@ jobs:
202200
exit 1
203201
fi
204202
205-
- name: Pre-populate the upstream/latest branch if first promotion
203+
- name: Merge upstream tag into upstream/latest
206204
working-directory: ./package-repo
207205
run: |
208206
@@ -214,7 +212,24 @@ jobs:
214212
else
215213
# The branch exists, check it out and promote it to the upstream tag
216214
git checkout upstream/latest
217-
git merge --ff-only ${{inputs.upstream-tag}}
215+
git merge ${{inputs.upstream-tag}}
216+
fi
217+
218+
- name: Strip .github/workflows from upstream/latest
219+
working-directory: ./package-repo
220+
run: |
221+
# Since Github does not allow pushing workflows using the GITHUB_TOKEN, remove .github/workflows if present.
222+
223+
git config user.name "${{vars.DEB_PKG_BOT_CI_NAME}}"
224+
git config user.email "${{vars.DEB_PKG_BOT_CI_EMAIL}}"
225+
226+
git checkout upstream/latest
227+
228+
# Remove .github/workflows/ if present to avoid GITHUB_TOKEN push restrictions.
229+
# The upstream source repo workflows are not relevant to the packaging repo.
230+
if [ -d .github/workflows ]; then
231+
git rm -rf .github/workflows
232+
git commit -s -m "Remove .github/workflows from upstream source"
218233
fi
219234
220235
- name: Merge upstream tag into packaging branch
@@ -263,6 +278,8 @@ jobs:
263278
- name: Open Promotion PR
264279
working-directory: ./package-repo
265280
run: |
281+
gh auth login --with-token <<< "${{secrets.GITHUB_TOKEN}}"
282+
266283
../qcom-build-utils/scripts/create_promotion_pr.py \
267284
--base-branch "${{inputs.debian-branch}}" \
268285
--upstream-tag "${{inputs.upstream-tag}}" \

0 commit comments

Comments
 (0)