diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index a051a28..685dc34 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -15,15 +15,12 @@ on: # Hourly rebuild of dev images - cron: "45 4 * * *" # At 04:45 every day - pull_request: - push: branches: - main + concurrency: - # Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags - # A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} cancel-in-progress: true @@ -37,12 +34,13 @@ jobs: if: always() runs-on: ubuntu-latest + permissions: {} timeout-minutes: 10 needs: - dev steps: - - uses: re-actors/alls-green@release/v1 + - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 id: alls-green with: jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 25bd6c0..338dc2c 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -4,29 +4,32 @@ on: types: - opened +permissions: {} + jobs: issue: # only run in posit-dev/images-workbench. if: github.repository == 'posit-dev/images-workbench' runs-on: ubuntu-latest + permissions: {} steps: - name: GitHub App Token - uses: actions/create-github-app-token@v3 + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 id: app-token with: app-id: ${{ secrets.WORKBENCH_IDE_RELEASE_APP_ID }} private-key: ${{ secrets.WORKBENCH_IDE_RELEASE_PEM }} - name: Add to Platform Carbon Project - uses: actions/add-to-project@v1.0.2 + uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2 with: github-token: ${{ steps.app-token.outputs.token }} project-url: https://github.com/orgs/posit-dev/projects/17 - name: Add Default Labels - uses: actions-ecosystem/action-add-labels@v1 - with: - github_token: ${{ steps.app-token.outputs.token }} - labels: | - docker + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + GH_REPO: ${{ github.repository }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + run: gh issue edit "$ISSUE_NUMBER" --add-label "docker" diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..386dc39 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,66 @@ +name: Pull Request +on: + pull_request: + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true + +jobs: + ci: + name: CI + if: always() + runs-on: ubuntu-latest + permissions: {} + timeout-minutes: 10 + needs: + - production + - development + - session + - zizmor + steps: + - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 + with: + jobs: ${{ toJSON(needs) }} + + production: + name: Production + permissions: + contents: read + packages: write + uses: posit-dev/images-shared/.github/workflows/bakery-build-pr.yml@main + with: + dev-versions: "exclude" + matrix-versions: "exclude" + + development: + name: Development + permissions: + contents: read + packages: write + uses: posit-dev/images-shared/.github/workflows/bakery-build-pr.yml@main + with: + dev-versions: "only" + matrix-versions: "exclude" + + session: + name: Session + permissions: + contents: read + packages: write + uses: posit-dev/images-shared/.github/workflows/bakery-build-pr.yml@main + with: + matrix-versions: "only" + + zizmor: + name: Zizmor + runs-on: ubuntu-latest + permissions: + contents: read + security-events: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2 diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index dc4abbe..a7f8fb7 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -6,15 +6,12 @@ on: # Weekly rebuild of all images, to pick up any upstream changes. - cron: "15 3 * * 0" # At 03:15 on Sunday - pull_request: - push: branches: - main + concurrency: - # Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags - # A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} cancel-in-progress: true @@ -28,13 +25,14 @@ jobs: if: always() runs-on: ubuntu-latest + permissions: {} timeout-minutes: 10 needs: - lint - build steps: - - uses: re-actors/alls-green@release/v1 + - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 id: alls-green with: jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a22baa..0f6b82e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,8 +7,14 @@ on: required: true type: string + jobs: release: + if: github.event_name == 'workflow_dispatch' + timeout-minutes: 10 + permissions: + contents: write + pull-requests: write uses: posit-dev/images-shared/.github/workflows/product-release.yml@main with: version: ${{ inputs.version }} diff --git a/.github/workflows/session.yml b/.github/workflows/session.yml index 2295b7e..e2a0962 100644 --- a/.github/workflows/session.yml +++ b/.github/workflows/session.yml @@ -6,15 +6,12 @@ on: # Weekly rebuild of all images, to pick up any upstream changes. - cron: "15 4 * * 0" # At 04:15 on Sunday - pull_request: - push: branches: - main + concurrency: - # Only cancel in-progress runs for pull_request events, this prevents cancelling workflows against main or tags - # A pull_request will reuse the same group thus enabling cancelation, all others receive a unique run_id group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} cancel-in-progress: true @@ -23,11 +20,12 @@ jobs: name: CI if: always() runs-on: ubuntu-latest + permissions: {} timeout-minutes: 10 needs: - build steps: - - uses: re-actors/alls-green@release/v1 + - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2 id: alls-green with: jobs: ${{ toJSON(needs) }} @@ -46,7 +44,7 @@ jobs: # Builds all versions of each image in parallel. # # Run on merges to main, or on weekly scheduled re-builds. - if: contains(fromJSON('["push", "pull_request"]'), github.event_name) || github.event.schedule == '15 3 * * 0' + if: github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' permissions: contents: read packages: write diff --git a/.github/zizmor.yml b/.github/zizmor.yml new file mode 100644 index 0000000..0533c12 --- /dev/null +++ b/.github/zizmor.yml @@ -0,0 +1,9 @@ +rules: + unpinned-uses: + config: + policies: + # Shared workflows and composite actions from images-shared + # are kept at @main intentionally. + "posit-dev/images-shared/*": ref-pin + "*": hash-pin +