Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GitHub Actionsと GitHub CLIと permissions
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ゆきか
November 22, 2024
Technology
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GitHub Actionsと GitHub CLIと permissions
ゆきか
November 22, 2024
More Decks by ゆきか
See All by ゆきか
新潟の鮨のはなし 飯テロver
yukikayuki
0
320
新潟WEBアプリケーション勉強会 Vol.1 LT GraphQL Federation
yukikayuki
0
150
React Hooks勉強会 vol.5
yukikayuki
2
380
Other Decks in Technology
See All in Technology
データエンジニアの困りごとをDevinと一緒に解消する
10xinc
2
810
AI時代におけるプロダクト横断勉強会の設計
zozotech
PRO
0
150
Driving AI Adoption Using In-House GPUs to Serve Qwen
po3rin
2
450
Genie Code ワークショップ 基礎編 / Genie-Code-Workshop-fundamental
databricksjapan
PRO
0
350
Kiro Crewしか勝たん!?
miu_crescent
PRO
0
180
Bet AI Day 2026丨How We Bet AI: AIとともに働く場をつくる
layerx
PRO
1
2.2k
[RSJ26] AnoleVLA: Lightweight Vision-Language-Action Model with Deep State Space Models for Mobile Manipulation
keio_smilab
PRO
0
120
設計の世代交代を乗り越える、14年続くAndroidアプリの開発戦略
sansantech
PRO
1
120
AIで仕事のやり方を変える
matsu7874
0
170
IoTハンズオンの舞台裏
shirouz
2
120
KAEN Company Deck
kaen
PRO
0
320
スクラムで身についていた動き方を、XPで捉え直してみた
codmoninc
PRO
1
200
Featured
See All Featured
Done Done
chrislema
186
16k
Evolving SEO for Evolving Search Engines
ryanjones
0
280
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
320
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
260
Accessibility Awareness
sabderemane
1
200
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Are puppies a ranking factor?
jonoalderson
2
3.9k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Transcript
GitHub Actionsと GitHub CLIと permissions 2024-11-22 Niigata 5Min Tech #14
@_yukikayuki
自己紹介 KANEDA Takayuki (@_yukikayuki) 株式会社モニクル ソフトウェアエンジニア(Web) + プロダクトSRE 最近メガネを変えた
GitHub ActionsでGitHub CLIを使いたいことあります か?
GitHub Actions(以降GHA)とは > GitHub Actions は、ビルド、テスト、デプロイのパイプラインを自動化でき る継続的インテグレーションと継続的デリバリー (CI/CD) のプラットフォームで す。
リポジトリに対するすべての pull request をビルドしてテストしたり、 マージされた pull request を運用環境にデプロイしたりするワークフローを 作成できます。
利用例 プルリクオープン時のテスト・リント・プレビュー環境へのデプロイ mainブランチへマージした時の本番デプロイ プレビュー環境のクリーニングの定期実行
GitHub CLI(以降ghコマンド)とは > GitHub CLI は、コンピューターのコマンド ラインから GitHub を使用する ためのオープン
ソース ツールです。 コマンドラインから作業しているときは、 GitHub CLI を使用して時間を節約し、コンテキストの切り替えを回避できま す。 できること: Issue と pull request の作成、クローズ、編集、一覧表示、プル リクエストのレビュー、diff、マージなどなど
利用例 リポジトリをクローンする Twitter(現X)で見かけたが、若い人はghコマンドでリポジトリをクローンし ている? ローカルマシンからプルリクを作る gh pr create --title "The
bug is fixed" --body "Everything works again" GHAでリポジトリの情報を取得して何かゴニョゴニョする
GHAでghコマンドを使うには?
jobs: info: runs-on: ubuntu-latest permissions: contents: read pull-requests: read steps:
- uses: actions/checkout@v4 - name: is pr closed shell: bash env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | pr_number=${{ github.event.pull_request.number }} is_pr_closed=$(gh pr view $pr_number --json closed -q '.closed') echo $is_pr_closed # false
jobs: info: runs-on: ubuntu-latest permissions: # permissionを指定 contents: read pull-requests:
read steps: - uses: actions/checkout@v4 - name: is pr closed shell: bash env: # 以下の形でGH_TOKENを設定 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | pr_number=${{ github.event.pull_request.number }} is_pr_closed=$( gh pr view $pr_number --json closed -q '.closed' ) echo $is_pr_closed # false
permission > 優れたセキュリティ プラクティスとし て、GITHUB_TOKEN に必要最小限の アクセス権を付与することをお勧めしま す。 permissions: actions:
read|write|none attestations: read|write|none checks: read|write|none contents: read|write|none deployments: read|write|none id-token: write|none issues: read|write|none discussions: read|write|none packages: read|write|none pages: read|write|none pull-requests: read|write|none repository-projects: read|write|none security-events: read|write|none statuses: read|write|none
参考URL • https://docs.github.com/ja/actions/about-github-actions/und erstanding-github-actions • https://docs.github.com/ja/github-cli/github-cli/about-github -cli • https://docs.github.com/ja/enterprise-cloud@latest/actions/ writing-workflows/choosing-what-your-workflow-does/contr
olling-permissions-for-github_token