@@ -21,14 +21,57 @@ permissions:
2121 pull-requests : write
2222 repository-projects : write
2323
24+ env :
25+ FAST_FORWARD_ACTIONS_REPOSITORY : php-fast-forward/.github
26+ FAST_FORWARD_ACTIONS_REF : ${{ github.repository != 'php-fast-forward/.github' && vars.FAST_FORWARD_ACTIONS_REF || '' }}
27+
2428jobs :
2529 resolve-project :
2630 runs-on : ubuntu-latest
2731 outputs :
2832 project_number : ${{ steps.resolve.outputs.project-number }}
2933 steps :
34+ - &resolve_shared_action_ref
35+ name : Resolve shared action ref
36+ id : shared_actions
37+ shell : bash
38+ env :
39+ GH_TOKEN : ${{ github.token }}
40+ CURRENT_REF : ${{ github.head_ref || github.ref_name }}
41+ BASE_SHA : ${{ github.event.pull_request.base.sha }}
42+ run : |
43+ set -euo pipefail
44+
45+ if [ -n "${FAST_FORWARD_ACTIONS_REF}" ]; then
46+ ref="${FAST_FORWARD_ACTIONS_REF}"
47+ elif [ "${GITHUB_REPOSITORY}" = "${FAST_FORWARD_ACTIONS_REPOSITORY}" ]; then
48+ if [ "${GITHUB_EVENT_NAME}" = "pull_request_target" ] && [ -n "${BASE_SHA:-}" ]; then
49+ ref="${BASE_SHA}"
50+ else
51+ ref="${CURRENT_REF:-main}"
52+ fi
53+ else
54+ ref="$(gh api "repos/${FAST_FORWARD_ACTIONS_REPOSITORY}/releases/latest" --jq .tag_name 2>/dev/null || true)"
55+
56+ if [ -z "${ref}" ] || [ "${ref}" = "null" ]; then
57+ ref="main"
58+ fi
59+ fi
60+
61+ echo "ref=${ref}" >> "${GITHUB_OUTPUT}"
62+
63+ - &checkout_shared_action_source
64+ name : Checkout shared action source
65+ uses : actions/checkout@v6
66+ with :
67+ repository : ${{ env.FAST_FORWARD_ACTIONS_REPOSITORY }}
68+ ref : ${{ steps.shared_actions.outputs.ref }}
69+ path : .fast-forward-actions
70+ sparse-checkout : |
71+ .github/actions
72+
3073 - id : resolve
31- uses : php- fast-forward/.github/.github/ actions/project-board/resolve@task/2-extract-shared-workflows
74+ uses : ./. fast-forward-actions /.github/actions/project-board/resolve
3275 with :
3376 project : ${{ inputs.project || vars.PROJECT || '' }}
3477
4689 if : github.event_name == 'issues' && needs.resolve-project.outputs.project_number != ''
4790 runs-on : ubuntu-latest
4891 steps :
49- - uses : php-fast-forward/.github/.github/actions/project-board/sync-status@task/2-extract-shared-workflows
92+ - *resolve_shared_action_ref
93+ - *checkout_shared_action_source
94+
95+ - uses : ./.fast-forward-actions/.github/actions/project-board/sync-status
5096 with :
5197 organization : ${{ github.repository_owner }}
5298 project : ${{ needs.resolve-project.outputs.project_number }}
@@ -58,7 +104,10 @@ jobs:
58104 if : github.event_name == 'pull_request_target' && needs.resolve-project.outputs.project_number != ''
59105 runs-on : ubuntu-latest
60106 steps :
61- - uses : php-fast-forward/.github/.github/actions/project-board/sync-linked-pr-metadata@task/2-extract-shared-workflows
107+ - *resolve_shared_action_ref
108+ - *checkout_shared_action_source
109+
110+ - uses : ./.fast-forward-actions/.github/actions/project-board/sync-linked-pr-metadata
62111
63112 sync-pull-request-status :
64113 needs : resolve-project
@@ -69,18 +118,21 @@ jobs:
69118 linked_issue_status : ${{ steps.compute.outputs.linked-issue-status }}
70119 pull_request_status : ${{ steps.compute.outputs.pull-request-status }}
71120 steps :
121+ - *resolve_shared_action_ref
122+ - *checkout_shared_action_source
123+
72124 - id : compute
73- uses : php- fast-forward/.github/.github/ actions/project-board/resolve-pr-status@task/2-extract-shared-workflows
125+ uses : ./. fast-forward-actions /.github/actions/project-board/resolve-pr-status
74126
75- - uses : php- fast-forward/.github/.github/ actions/project-board/sync-status@task/2-extract-shared-workflows
127+ - uses : ./. fast-forward-actions /.github/actions/project-board/sync-status
76128 with :
77129 organization : ${{ github.repository_owner }}
78130 project : ${{ needs.resolve-project.outputs.project_number }}
79131 resource-node-id : ${{ github.event.pull_request.node_id }}
80132 status-value : ${{ steps.compute.outputs.pull-request-status }}
81133
82134 - if : steps.compute.outputs.linked-issue-node-id != '' && steps.compute.outputs.linked-issue-status != ''
83- uses : php- fast-forward/.github/.github/ actions/project-board/sync-status@task/2-extract-shared-workflows
135+ uses : ./. fast-forward-actions /.github/actions/project-board/sync-status
84136 with :
85137 organization : ${{ github.repository_owner }}
86138 project : ${{ needs.resolve-project.outputs.project_number }}
@@ -92,10 +144,13 @@ jobs:
92144 if : github.event_name == 'pull_request_review' && needs.resolve-project.outputs.project_number != ''
93145 runs-on : ubuntu-latest
94146 steps :
147+ - *resolve_shared_action_ref
148+ - *checkout_shared_action_source
149+
95150 - id : compute
96- uses : php- fast-forward/.github/.github/ actions/project-board/resolve-review-status@task/2-extract-shared-workflows
151+ uses : ./. fast-forward-actions /.github/actions/project-board/resolve-review-status
97152
98- - uses : php- fast-forward/.github/.github/ actions/project-board/sync-status@task/2-extract-shared-workflows
153+ - uses : ./. fast-forward-actions /.github/actions/project-board/sync-status
99154 with :
100155 organization : ${{ github.repository_owner }}
101156 project : ${{ needs.resolve-project.outputs.project_number }}
0 commit comments