بادئ ذي بدء ، شكرًا لك على إطلاق السيارة ، إنه لمن دواعي سروري أن تستخدمه ، كما أن منع إرسال الرسائل من الدراجة يعد بمثابة هبة من السماء!
صف الخلل
يبدو أن auto shipit
لا يستخدم GH_TOKEN
لمصادقة دفعه إلى الريبو الخاص بنا والمؤسسة:
npm notice integrity: sha512-kXkHqsVqSmGJl[...]cfW+F0SWxcjBg==
npm notice total files: 57
npm notice
Error: Running command 'git' with args [push, --follow-tags, --set-upstream, https://github.com/COMPANY/REPO, master] failed
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least 1 approving review is required by reviewers with write access.
To https://github.com/finanzcheck/traversal-editor
* [new tag] v0.6.5 -> v0.6.5
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to 'https://github.com/COMPANY/REPO'
at ChildProcess.<anonymous> (/home/runner/work/REPO/REPO/node_modules/@auto-it/core/dist/utils/exec-promise.js:49:24)
at ChildProcess.emit (events.js:311:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 1.
نحن نستخدم رمز مستخدم Bot مثل GH_TOKEN
، NPM_TOKEN
و NODE_AUTH_TOKEN
مع النطاقات الصحيحة ، وهو مسؤول الريبو. على الرغم من ذلك ، لا تزال متطلبات فحص الحالة والمراجعة سارية ، بغض النظر عن قيمة "تضمين المسؤولين" في قيود الفرع.
لقد تحققنا من الدفع المباشر بحيث يمكن لمستخدم الروبوت دفع الالتزامات مباشرة لإتقانها. حاولنا أيضًا استخدام الرموز المميزة لمطورين وواجهنا نفس المشكلة.
تفاصيل مثيرة للاهتمام ، سير عمل Github ينفذ "بشكل صحيح" عند الدفع مباشرة إلى master
. لا يزال يفشل في دفع الالتزامات ولكن البرنامج النصي لا يخطئ:
npm notice
+ @COMPANY/[email protected]
remote: error: GH006: Protected branch update failed for refs/heads/master.
remote: error: At least 1 approving review is required by reviewers with write access.
To https://github.com/COMPANY/REPO.git
* [new tag] v0.6.2 -> v0.6.2
! [remote rejected] master -> master (protected branch hook declined)
error: failed to push some refs to '***github.com/COMPANY/REPO.git'
ℹ info Current "Latest Release" on Github: v0.6.1
ℹ info Using release notes:
#### ⚠️ Pushed to `master`
- COMMIT
#### Authors: 1
- AUTHOR
ℹ info Releasing v0.6.2 to GitHub.
auto shipit
يعمل بشكل جيد مع العلاقات العامة ، وهو أمر غريب ، لأن سير عمل Github متطابق ، باستثناء بعض الشروط المبنية على تسميات العلاقات العامة.
لإعادة إنتاج
auto shipit
على العلاقات العامةتشغيل auto shipit
على المستوى الرئيسي -> فشل
ادفع مباشرة لإتقان
auto shipit
-> works-ish ، لا يزال الدفع يفشل ، لكن النص لا يخطئسلوك متوقع
الدفع لا يفشل
لقطات
إذا أمكن ، أضف لقطات شاشة للمساعدة في شرح مشكلتك.معلومات البيئة:
الرجاء تشغيل "npx auto info" ووضع النتائج في القسم أدناهEnvironment Information:
"auto" version: v9.15.2
"git" version: v2.25.0
"node" version: v13.8.0
Project Information:
✔ Repository: COMPANY/REPO
✔ Author Name: Robert Wawrzyniak
✔ Author Email: [redacted]
✔ Current Version: v0.6.6
✔ Latest Release: v0.6.2
✔ Labels configured on GitHub project
GitHub Token Information:
✔ Token: [Token starting with 52ba]
✔ Repo Permission: admin
✔ User: thuringia
✔ API: https://api.github.com
✔ Enabled Scopes: gist, notifications, read:packages, repo, write:packages
✔ Rate Limit: 4997/5000
✨ Done in 42.03s.
Time: 0h:00m:43s
سياق إضافي
إليك سير عمل Github الذي ينفذ auto
:
name: Release on master
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message , 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout<strong i="9">@v2</strong>
- run: git fetch --prune --unshallow --tags
- uses: actions/setup-node<strong i="10">@v1</strong>
with:
node-version: "12.x"
registry-url: "https://npm.pkg.github.com/"
scope: "@COMPANY"
- id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache<strong i="11">@v1</strong>
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
- uses: actions/cache<strong i="12">@v1</strong>
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Create Release
env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn build:library
yarn autorelease
# yarn build: library runs babel
# yarn autorelease is just "auto shipit"
هل نجح هذا من قبل؟ لقد تلاعبت مؤخرًا برمز يمكن أن يؤثر على ذلك.
راجع للشغل شكرا لكتابة القضية الرائعة!
لست متأكدًا من أن هذا نجح على الإطلاق لأكون صادقًا
كنت أعمل مع Gitlab خلال العام الماضي أو نحو ذلك ... قواعد مختلفة جدًا للعلاقات العامة وما شابه ذلك
اسمحوا لي أن أعرف ، إذا كان بإمكاني مساعدتك في تصحيح هذا ، أو دعمك بطريقة أخرى
بعد بعض التجارب والخطأ ، تمكنت من توضيح الأسباب الجذرية المحتملة بشكل أكبر ، فقد يكون أحدهما مرتبطًا بـ auto
والآخر قد يكون مشكلة مع Github نفسه.
تمكنا من الدفع باستخدام خدعة مماثلة لتلك المذكورة في # 945 لتعديل git origin
.
ومع ذلك ، فإنها لا تزال لا تعمل ... ما لم نقم بتعطيل متطلبات موافقات العلاقات العامة في حماية الفرع …… والتي لا ينبغي أن تكون مشكلة لأننا نستخدم مستخدمًا على مستوى المسؤول ، ولكن ها نحن ذا.
_ تصحيح: _ لم يعد يعمل إذا كانت فحوصات الحالة مطلوبة. حماية فرع Github هي بالتأكيد مشكلة. لا بد لي من تعطيل موافقات العلاقات العامة والتحقق من الحالة في الوقت الحالي
يمكن معالجة git origin
بواسطة auto
باستخدام GH_TOKEN
لمصادقة دفعه ، ربما خلف علامة ميزة أو شيء من هذا القبيل. قد يتطلب الآخر بعض الوثائق والعمل حول Github.
هل تعتقد أن مثل هذا الإعداد سيكون فكرة جيدة مقابل auto
؟
كمرجع ، يمكننا الدفع بشكل صحيح باستخدام عنوان URL هذا:
git remote add origin "https://[email protected]/COMPANY/REPO"
hipstersmoothie أرى ما تعنيه ب "العبث" (# 1036) هذا يحل معظم المشكلة ، شكرًا جزيلاً لك!
هل اختبرت هذا مع تمكين تنبؤات الفروع؟ أشعر بالقلق من لمس هذه القائمة 😆
لم أختبر مع تمكين حماية الفرع. ولكن إذا فشلت لهذا السبب ، أعتقد أن كل ما عليك فعله هو إضافة GH_TOKEN الخاص بك بإذن repo
سأختبر بسرعة حقيقية على https://github.com/hipstersmoothie/create-check
الحصول على الخطأ الخاص بك https://github.com/hipstersmoothie/create-check/runs/495554019
يبدو أن هذه مشكلة في إجراءات GitHub. https://github.community/t5/GitHub-Actions/Allowing-github-actions-bot-to-push-to-protected-branch/td-p/34367
https://github.com/semantic-release/github/issues/175#issuecomment -527224825
يبدو أن الحلول هي:
repo
واستخدمها بدلاً من GH_TOKENمن المؤسف أنه لا يمكنك إضافة الروبوت كمسؤول.
أواجه صعوبة كبيرة في الحصول على أي شيء للعمل :(
الكثير من الناس يريدون هذا بالرغم من ذلك. https://github.community/t5/GitHub-Actions/How-to-push-to-protected-branches-in-a-GitHub-Action/td-p/29609
حسنًا ، يمكنني الحصول على checkoutv1 للعمل ولكن ليس الخروج v2
thuringia هل يمكنك تجربة v9.19.3
وإضافة ما يلي إلى الإجراء؟
steps:
- uses: actions/checkout<strong i="8">@v2</strong>
with:
# Make sure to get all the commits
fetch-depth: 0
- name: Prepare repository
# Fetch the rest of the git info (tags)
run: git fetch --prune
- name: Unset header
# checkout<strong i="9">@v2</strong> adds a header that makes branch protection report errors ):
run: git config --local --unset http.https://github.com/.extraheader
hipstersmoothie كل شيء يعمل الآن 😃
هذا العنوان الإضافي ممتع للغاية ، لم أره يذكر كثيرًا.
يبدو أن أحد الآثار الجانبية لإزالة الرأس هو أن الدفع بدون بيانات اعتماد صريحة لم يعد يعمل:
fatal: could not read Username for 'https://github.com': No such device or address
يؤدي استبدال معظم نص الإصدار بـ auto shipit
إصلاح هذا على الرغم من:
export PATH=$(npm bin):$PATH
VERSION=`auto version`
## Support for label 'skip-release'
if [ ! -z "$VERSION" ]; then
yarn auto shipit
fi
شكرا جزيلا للمساعدة السريعة لك!
auto shipit
بفحص هذا الإصدار نيابةً عنك. لذلك كل ما عليك فعله هو تشغيل auto shipit
🎉 فقط لا حاجة إلى نص برمجي
: صاروخ: تم إصدار الإصدار في v9.19.4
: صاروخ: