Skip to content

Commit ee5d0bd

Browse files
committed
Make sure other actions do not run in the private fork
1 parent dd3f27b commit ee5d0bd

File tree

7 files changed

+84
-76
lines changed

7 files changed

+84
-76
lines changed

.github/workflows/cla.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
issue_comment:
44
types: [created]
55
pull_request_target:
6-
types: [opened,closed,synchronize]
6+
types: [opened, closed, synchronize]
77

88
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
99
permissions:
@@ -14,6 +14,7 @@ permissions:
1414

1515
jobs:
1616
CLAAssistant:
17+
if: github.repository == 'opf/openproject'
1718
runs-on: ubuntu-latest
1819
steps:
1920
- name: "CLA Assistant"
@@ -23,10 +24,10 @@ jobs:
2324
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2425
PERSONAL_ACCESS_TOKEN: ${{ secrets.OPENPROJECTCI_GH_LEGAL_TOKEN }}
2526
with:
26-
path-to-signatures: 'contributor-license-agreement/signatures/version1.json'
27-
path-to-document: 'https://www.openproject.org/legal/contributor-license-agreement' # e.g. a CLA or a DCO document
27+
path-to-signatures: "contributor-license-agreement/signatures/version1.json"
28+
path-to-document: "https://www.openproject.org/legal/contributor-license-agreement" # e.g. a CLA or a DCO document
2829
# branch should not be protected
29-
branch: 'main'
30+
branch: "main"
3031
allowlist: >
3132
Copilot,
3233
Daten-David,

.github/workflows/codeql-scan-core.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: codeql
22

33
on:
44
push:
5-
branches: [ "dev", "release/*", "stable/*" ]
5+
branches: ["dev", "release/*", "stable/*"]
66
pull_request:
7-
branches: [ "dev", "release/*", "stable/*" ]
7+
branches: ["dev", "release/*", "stable/*"]
88
paths-ignore:
9-
- 'docs/**'
9+
- "docs/**"
1010
schedule:
11-
- cron: '32 1 * * 2'
11+
- cron: "32 1 * * 2"
1212

1313
jobs:
1414
analyze:
15+
if: github.repository == 'opf/openproject'
1516
name: Analyze
16-
runs-on: 'ubuntu-latest'
17+
runs-on: "ubuntu-latest"
1718
timeout-minutes: 120
1819
permissions:
1920
# required for all workflows
@@ -26,7 +27,7 @@ jobs:
2627
strategy:
2728
fail-fast: false
2829
matrix:
29-
language: [ 'javascript-typescript', 'ruby' ]
30+
language: ["javascript-typescript", "ruby"]
3031

3132
steps:
3233
- name: Checkout repository

.github/workflows/create-merge-from-previous-release-branch-pr.yml

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,49 @@
11
name: create-merge-from-previous-release-branch
22
on:
33
push:
4-
branches: [ "release/*" ]
4+
branches: ["release/*"]
55
workflow_dispatch:
66

77
permissions: {}
88
jobs:
99
setup:
10+
if: github.repository == 'opf/openproject'
1011
runs-on: ubuntu-latest
1112
outputs:
1213
previous_release_branch: ${{ steps.find_previous_release.outputs.branch }}
1314
latest_release_branch: ${{ steps.find_latest_release.outputs.branch }}
1415
steps:
15-
- id: find_previous_release
16-
env:
17-
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
18-
GITHUB_REPOSITORY: ${{ github.repository }}
19-
run: |
20-
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
21-
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
22-
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -2 | head -1
23-
)
24-
if [ "$BRANCH" = "" ]; then
25-
echo "Invalid release branch found: $BRANCH"
26-
exit 1
27-
fi
28-
echo "Found previous release branch: $BRANCH"
29-
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
30-
- id: find_latest_release
31-
env:
32-
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
33-
GITHUB_REPOSITORY: ${{ github.repository }}
34-
run: |
35-
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
36-
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
37-
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
38-
)
39-
if [ "$BRANCH" = "" ]; then
40-
echo "Invalid release branch found: $BRANCH"
41-
exit 1
42-
fi
43-
44-
echo "Found current release branch: $BRANCH"
45-
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
16+
- id: find_previous_release
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
19+
GITHUB_REPOSITORY: ${{ github.repository }}
20+
run: |
21+
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
22+
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
23+
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -2 | head -1
24+
)
25+
if [ "$BRANCH" = "" ]; then
26+
echo "Invalid release branch found: $BRANCH"
27+
exit 1
28+
fi
29+
echo "Found previous release branch: $BRANCH"
30+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
31+
- id: find_latest_release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
34+
GITHUB_REPOSITORY: ${{ github.repository }}
35+
run: |
36+
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
37+
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
38+
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
39+
)
40+
if [ "$BRANCH" = "" ]; then
41+
echo "Invalid release branch found: $BRANCH"
42+
exit 1
43+
fi
44+
45+
echo "Found current release branch: $BRANCH"
46+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
4647
merge-or-create-pr:
4748
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_name == needs.setup.outputs.previous_release_branch)
4849
env:
@@ -67,11 +68,11 @@ jobs:
6768
# Calculate a reasonable date to fetch from (e.g., 6 months ago)
6869
SINCE_DATE=$(date -d '3 months ago' '+%Y-%m-%d')
6970
echo "Fetching commits since: $SINCE_DATE"
70-
71+
7172
# Fetch both branches with commits since the calculated date
7273
git fetch --shallow-since="$SINCE_DATE" origin "$RELEASE_BRANCH" "$PREVIOUS_RELEASE_BRANCH" || {
7374
echo "Shallow-since fetch failed, trying with depth strategy..."
74-
75+
7576
# Fallback: Use progressive deepening
7677
git fetch --depth=50 origin "$RELEASE_BRANCH" "$PREVIOUS_RELEASE_BRANCH"
7778
for depth in 100 200 500 1000; do
@@ -98,7 +99,7 @@ jobs:
9899
else
99100
echo "⚠️ Could not find merge-base, operations may be limited"
100101
fi
101-
102+
102103
echo "Branch $RELEASE_BRANCH has $(git rev-list --count origin/$RELEASE_BRANCH) commits"
103104
echo "Branch $PREVIOUS_RELEASE_BRANCH has $(git rev-list --count origin/$PREVIOUS_RELEASE_BRANCH) commits"
104105

.github/workflows/create-merge-release-into-dev-pr.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@ name: create-merge-release-into-dev-pr
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '30 3 * * *' # Daily at 03:30
5+
- cron: "30 3 * * *" # Daily at 03:30
66

77
env:
88
BASE_BRANCH: dev
99

1010
permissions: {}
1111
jobs:
1212
setup:
13+
if: github.repository == 'opf/openproject'
1314
runs-on: ubuntu-latest
1415
outputs:
1516
latest_release_branch: ${{ steps.find_latest_release.outputs.branch }}
1617
steps:
17-
- id: find_latest_release
18-
env:
19-
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
20-
GITHUB_REPOSITORY: ${{ github.repository }}
21-
run: |
22-
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
23-
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
24-
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
25-
)
26-
if [ "$BRANCH" = "" ]; then
27-
echo "Invalid release branch found: $BRANCH"
28-
exit 1
29-
fi
30-
31-
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
18+
- id: find_latest_release
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.OPENPROJECTCI_GH_CORE_PAT }}
21+
GITHUB_REPOSITORY: ${{ github.repository }}
22+
run: |
23+
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
24+
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
25+
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
26+
)
27+
if [ "$BRANCH" = "" ]; then
28+
echo "Invalid release branch found: $BRANCH"
29+
exit 1
30+
fi
31+
32+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
3233
3334
merge-or-create-pr:
3435
env:

.github/workflows/crowdin.yml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@ name: crowdin
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '0 3 * * *' # Daily at 03:00
5+
- cron: "0 3 * * *" # Daily at 03:00
66

77
permissions: {}
88
jobs:
99
setup:
10+
if: github.repository == 'opf/openproject'
1011
runs-on: ubuntu-latest
1112
outputs:
1213
latest_release_branch: ${{ steps.find_latest_release.outputs.branch }}
1314
steps:
14-
- id: find_latest_release
15-
env:
16-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17-
GITHUB_REPOSITORY: ${{ github.repository }}
18-
run: |
19-
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
20-
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
21-
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
22-
)
23-
if [ "$BRANCH" = "" ]; then
24-
echo "Invalid release branch found: $BRANCH"
25-
exit 1
26-
fi
15+
- id: find_latest_release
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
GITHUB_REPOSITORY: ${{ github.repository }}
19+
run: |
20+
BRANCH=$(curl -H "Authorization: token $GITHUB_TOKEN" \
21+
https://api.github.com/repos/$GITHUB_REPOSITORY/branches?protected=true | \
22+
jq -r '.[].name' | grep '^release/' | sort --version-sort | tail -1
23+
)
24+
if [ "$BRANCH" = "" ]; then
25+
echo "Invalid release branch found: $BRANCH"
26+
exit 1
27+
fi
2728
28-
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
29+
echo "branch=${BRANCH}" >> $GITHUB_OUTPUT
2930
3031
crowdin:
3132
permissions:

.github/workflows/docker-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212

1313
jobs:
1414
compute-inputs:
15+
if: github.repository == 'opf/openproject'
1516
runs-on: ubuntu-latest
1617
outputs:
1718
tag: ${{ steps.compute.outputs.tag }}

.github/workflows/docker-scheduled.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ on:
88

99
jobs:
1010
build-dev:
11+
if: github.repository == 'opf/openproject'
1112
uses: ./.github/workflows/docker.yml
1213
with:
1314
branch: dev
1415
tag: dev
1516
secrets: inherit
1617
build-release-candidate:
18+
if: github.repository == 'opf/openproject'
1719
# References to release/X.Y and X.Y-rc are being
1820
# updated from the devkit (UpdateWorkflows step) whenever a new release branch is created
1921
uses: opf/openproject/.github/workflows/docker.yml@release/17.1

0 commit comments

Comments
 (0)