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
ゆきか
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
300
新潟WEBアプリケーション勉強会 Vol.1 LT GraphQL Federation
yukikayuki
0
150
React Hooks勉強会 vol.5
yukikayuki
2
380
Other Decks in Technology
See All in Technology
TypeScript入門 2026
recruitengineers
PRO
3
570
サイバー捜査員研修(後半)
nomizone
1
870
事業価値と Engineering 2026年度版
recruitengineers
PRO
49
23k
Forza Horizon 6 のテレメトリ機能で 自動運転に使えそうな学習データを集める話
henjin0
0
170
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
710
AIペネトレーションテスト・ セキュリティ検証「AgenticSec」紹介資料
laysakura
2
9k
モノリス Rails でも日中に rails db:migrate を走らせたい! / Daytime rails db:migrate on Monolithic Rails!
euglena1215
4
580
強化学習「理論」入門
enakai00
3
3.6k
【CEDEC2026】ゲームシナリオライターを支援するAIツール開発の実践 ― 設計とプロンプトの工夫 ―
cygames
PRO
1
800
LLM・AIエージェントシステムベストプラクティス
shibuiwilliam
6
1.2k
DatadogのBits Chatが開発組織にもたらしたもの / What Bits Chat Has Brought Us
sms_tech
1
260
攻撃と防御で学ぶAI時代のプロダクトセキュリティ演習
recruitengineers
PRO
9
2.7k
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
24k
Skip the Path - Find Your Career Trail
mkilby
1
180
A Modern Web Designer's Workflow
chriscoyier
698
190k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
The Language of Interfaces
destraynor
162
27k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
73
41k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
400
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
480
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