Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflow to protextfrom but run external PRs #2440

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: "Pull Request Labeler"
on:
- pull_request_target
# name: "Pull Request Labeler"
# on:
# - pull_request_target

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}
- uses: actions/labeler@v5
with:
sync-labels: true
repo-token: ${{ steps.app-token.outputs.token }}
# jobs:
# labeler:
# permissions:
# contents: read
# pull-requests: write
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: actions/create-github-app-token@v1
# id: app-token
# with:
# app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
# private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}
# - uses: actions/labeler@v5
# with:
# sync-labels: true
# repo-token: ${{ steps.app-token.outputs.token }}
34 changes: 28 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
push:
branches: ["main"]
tags-ignore: ["v*-*"]
pull_request:
pull_request_target:
types: [opened, synchronize, labeled]
branches: ["main"]
workflow_dispatch:
inputs:
Expand All @@ -31,6 +32,11 @@ jobs:
# Setup & Configuration
Setup:
name: "Setup & Configuration "
if: ${{ (github.event_name == 'push') ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'pull_request_target' &&
(github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'safe-to-build')))
}}
runs-on: ubuntu-latest
outputs:
GitVersion_BranchName: ${{ steps.gitversion.outputs.GitVersion_BranchName }}
Expand All @@ -54,9 +60,22 @@ jobs:
nkdAgility_RunRelease: ${{ steps.nkdagility.outputs.RunRelease }}
nkdAgility_AzureSitesEnvironment: ${{ steps.nkdagility.outputs.AzureSitesEnvironment }}
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}
- name: Remove "safe" label from PR
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: actions-ecosystem/action-remove-labels@v1
with:
token: ${{ steps.app-token.outputs.token }}
labels: safe-to-build
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
Expand All @@ -68,11 +87,7 @@ jobs:
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.NKDAGILITY_BOT_APP_ID }}
private-key: ${{ secrets.NKDAGILITY_BOT_CLIENTSECRET }}

- uses: dorny/paths-filter@v3
id: filter
with:
Expand All @@ -84,6 +99,7 @@ jobs:
automation:
- 'build/**'
- '.github/workflows/**'

- name: "Build NKDAgility Outputs"
shell: pwsh
id: nkdagility
Expand Down Expand Up @@ -261,6 +277,9 @@ jobs:
distribution: 'zulu'
- name: Checkout
uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
- uses: cschleiden/replace-tokens@v1
with:
files: '["**/StaticVariables.cs"]'
Expand Down Expand Up @@ -341,6 +360,9 @@ jobs:
GitVersion_InformationalVersion: ${{ needs.Setup.outputs.GitVersion_InformationalVersion }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event_name == 'push' && github.repository || github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event_name == 'push' && github.ref || github.event.pull_request.head.ref }}
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
Expand Down