File tree Expand file tree Collapse file tree 5 files changed +65
-10
lines changed
Expand file tree Collapse file tree 5 files changed +65
-10
lines changed Original file line number Diff line number Diff line change 1+ on :
2+ workflow_call :
3+ outputs :
4+ branch-pr :
5+ description : The PR number if the branch is in one
6+ value : ${{ jobs.pr.outputs.branch-pr }}
7+
8+ jobs :
9+ pr :
10+ runs-on : " ubuntu-latest"
11+ outputs :
12+ branch-pr : ${{ steps.script.outputs.result }}
13+ steps :
14+ - uses : actions/github-script@v7
15+ id : script
16+ if : github.event_name == 'push'
17+ with :
18+ script : |
19+ const prs = await github.rest.pulls.list({
20+ owner: context.repo.owner,
21+ repo: context.repo.repo,
22+ head: context.repo.owner + ':${{ github.ref_name }}'
23+ })
24+ if (prs.data.length) {
25+ console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`)
26+ return prs.data[0]["number"]
27+ }
Original file line number Diff line number Diff line change 11name : " Release dev container features & Generate Documentation"
22on :
3+ # use this to test releasing of the devcontainer features in a branch
34 workflow_dispatch :
4- push :
5- branches :
6- - main
5+ workflow_call :
76
87jobs :
98 deploy :
109 runs-on : ubuntu-latest
1110 permissions :
1211 contents : write
13- pull-requests : write
1412 packages : write
1513 steps :
1614 - uses : actions/checkout@v4
1715
1816 - name : patch in version tag
19- # patch the version tag if the version is a valid semver. If not the
20- # default to the
17+ # patch the version tag if the version is a valid semver. If not then
18+ # default to 0.0.0-b1 (only when using workflow_dispatch for tests)
2119 run : |
2220 if [[ ${{ github.ref_name }} =~ ^[0-9]+\.[0-9]+.+ ]] ; then
2321 sed -i s/0\.0\.0-b1/${{ github.ref_name }}/ $(find .devcontainer -name devcontainer-feature.json)
3533 env :
3634 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3735
36+ # the example features publishes docs like below - I believe this is only
37+ # relevant if publishing to the marketplace?
38+
3839 # - name: Create PR for Documentation
3940 # id: push_image_info
4041 # env:
Original file line number Diff line number Diff line change 11name : " CI - Test Features"
22on :
3- push :
4- pull_request :
3+ workflow_call :
54
65jobs :
76 test-autogenerated :
2019 - name : " Install latest devcontainer CLI"
2120 run : |
2221 npm install -g @devcontainers/cli
23- mkdir -p ~/.config/devcontainer_rc
22+ mkdir -p ~/.config/bash-config
2423
2524 - name : " Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
2625 run : devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} .
Original file line number Diff line number Diff line change 11name : " Validate devcontainer-feature.json files"
22on :
3- pull_request :
3+ workflow_call :
44
55jobs :
66 validate :
Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ pull_request :
6+
7+ jobs :
8+ check :
9+ uses : ./.github/workflows/_check.yml
10+
11+ validate :
12+ needs : check
13+ if : needs.check.outputs.branch-pr == ''
14+ uses : ./.github/workflows/_validate.yml
15+
16+ test :
17+ needs : check
18+ if : needs.check.outputs.branch-pr == ''
19+ uses : ./.github/workflows/_test.yml
20+
21+ release :
22+ if : github.ref_type == 'tag'
23+ needs : test
24+ uses : ./.github/workflows/_release.yml
25+ permissions :
26+ contents : write
27+ packages : write
28+
You can’t perform that action at this time.
0 commit comments