From b1fbd3e5bc1ed76c3803cf201ea4bb36b5f1bd0e Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 23 Mar 2023 14:07:43 -0400 Subject: [PATCH 1/2] doc: add initial version of actions Signed-off-by: Michael Dawson --- .github/.syncignore | 2 + .github/CODEOWNERS | 1 + .github/dependabot.yml | 7 ++ .github/labels.yml | 39 +++++++ .github/workflows/approve-bot-pr.yml | 69 ++++++++++++ .github/workflows/codeql-analysis.yml | 35 +++++++ .github/workflows/create-draft-release.yml | 116 +++++++++++++++++++++ .github/workflows/go-get-update.yml | 52 +++++++++ .github/workflows/label-pr.yml | 33 ++++++ .github/workflows/lint-yaml.yml | 30 ++++++ .github/workflows/lint.yml | 28 +++++ .github/workflows/push-buildpackage.yml | 94 +++++++++++++++++ .github/workflows/synchronize-labels.yml | 18 ++++ .github/workflows/test-pull-request.yml | 39 +++++++ .github/workflows/update-github-config.yml | 62 +++++++++++ 15 files changed, 625 insertions(+) create mode 100644 .github/.syncignore create mode 100644 .github/CODEOWNERS create mode 100644 .github/dependabot.yml create mode 100644 .github/labels.yml create mode 100644 .github/workflows/approve-bot-pr.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 .github/workflows/create-draft-release.yml create mode 100644 .github/workflows/go-get-update.yml create mode 100644 .github/workflows/label-pr.yml create mode 100644 .github/workflows/lint-yaml.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/push-buildpackage.yml create mode 100644 .github/workflows/synchronize-labels.yml create mode 100644 .github/workflows/test-pull-request.yml create mode 100644 .github/workflows/update-github-config.yml diff --git a/.github/.syncignore b/.github/.syncignore new file mode 100644 index 0000000..b82bab2 --- /dev/null +++ b/.github/.syncignore @@ -0,0 +1,2 @@ +CODEOWNERS +workflows/update-dependencies.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..01749b1 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @paketo-buildpacks/nodejs-maintainers diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bf49a9d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +--- +version: 2 +updates: +- package-ecosystem: gomod + directory: "/" + schedule: + interval: daily diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..0760b68 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,39 @@ +- name: status/possible-priority + description: This issue is ready to work and should be considered as a potential priority + color: F9D0C4 +- name: status/prioritized + description: This issue has been triaged and resolving it is a priority + color: BFD4F2 +- name: status/blocked + description: This issue has been triaged and resolving it is blocked on some other issue + color: 848978 +- name: bug + description: Something isn't working + color: d73a4a +- name: enhancement + description: A new feature or request + color: a2eeef +- name: documentation + description: This issue relates to writing documentation + color: D4C5F9 +- name: semver:major + description: A change requiring a major version bump + color: 6b230e +- name: semver:minor + description: A change requiring a minor version bump + color: cc6749 +- name: semver:patch + description: A change requiring a patch version bump + color: f9d0c4 +- name: good first issue + description: A good first issue to get started with + color: d3fc03 +- name: "failure:release" + description: An issue filed automatically when a release workflow run fails + color: f00a0a +- name: "failure:push" + description: An issue filed automatically when a push buildpackage workflow run fails + color: f00a0a +- name: "failure/update-dependencies" + description: An issue filed automatically when updating buildpack.toml dependencies fails in a workflow + color: f00a0a diff --git a/.github/workflows/approve-bot-pr.yml b/.github/workflows/approve-bot-pr.yml new file mode 100644 index 0000000..c798e64 --- /dev/null +++ b/.github/workflows/approve-bot-pr.yml @@ -0,0 +1,69 @@ +name: Approve Bot PRs and Enable Auto-Merge + +on: + workflow_run: + workflows: ["Test Pull Request"] + types: + - completed + +jobs: + download: + name: Download PR Artifact + if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-22.04 + outputs: + pr-author: ${{ steps.pr-data.outputs.author }} + pr-number: ${{ steps.pr-data.outputs.number }} + steps: + - name: 'Download artifact' + uses: paketo-buildpacks/github-config/actions/pull-request/download-artifact@main + with: + name: "event-payload" + repo: ${{ github.repository }} + run_id: ${{ github.event.workflow_run.id }} + workspace: "/github/workspace" + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + - id: pr-data + run: | + echo "author=$(cat event.json | jq -r '.pull_request.user.login')" >> "$GITHUB_OUTPUT" + echo "number=$(cat event.json | jq -r '.pull_request.number')" >> "$GITHUB_OUTPUT" + + approve: + name: Approve Bot PRs + needs: download + if: ${{ needs.download.outputs.pr-author == 'paketo-bot' || needs.download.outputs.pr-author == 'dependabot[bot]' }} + runs-on: ubuntu-22.04 + steps: + - name: Check Commit Verification + id: unverified-commits + uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + repo: ${{ github.repository }} + number: ${{ needs.download.outputs.pr-number }} + + - name: Check for Human Commits + id: human-commits + uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + repo: ${{ github.repository }} + number: ${{ needs.download.outputs.pr-number }} + + - name: Checkout + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + uses: actions/checkout@v3 + + - name: Approve + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + uses: paketo-buildpacks/github-config/actions/pull-request/approve@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + number: ${{ needs.download.outputs.pr-number }} + + - name: Enable Auto-Merge + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + run: | + gh pr merge ${{ needs.download.outputs.pr-number }} --auto --rebase + env: + GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..3d8768b --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,35 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '0 0 * * *' # Once a day at midnight + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + language: + - 'go' + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml new file mode 100644 index 0000000..ad59955 --- /dev/null +++ b/.github/workflows/create-draft-release.yml @@ -0,0 +1,116 @@ +name: Create or Update Draft Release + +on: + push: + branches: + - main + repository_dispatch: + types: [ version-bump ] + workflow_dispatch: + inputs: + version: + description: 'Version of the release to cut (e.g. 1.2.3)' + required: false + +concurrency: release + +jobs: + unit: + name: Unit Tests + runs-on: ubuntu-22.04 + outputs: + builders: ${{ steps.builders.outputs.builders }} + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + - name: Checkout + uses: actions/checkout@v3 + - name: Run Unit Tests + run: ./scripts/unit.sh + + release: + name: Release + runs-on: ubuntu-22.04 + needs: unit + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + - name: Checkout + uses: actions/checkout@v3 + - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true + - name: Reset Draft Release + id: reset + uses: paketo-buildpacks/github-config/actions/release/reset-draft@main + with: + repo: ${{ github.repository }} + token: ${{ github.token }} + - name: Calculate Semver Tag + if: github.event.inputs.version == '' + id: semver + uses: paketo-buildpacks/github-config/actions/tag/calculate-semver@main + with: + repo: ${{ github.repository }} + token: ${{ github.token }} + ref-name: ${{ github.ref_name }} + - name: Set Release Tag + id: tag + run: | + tag="${{ github.event.inputs.version }}" + if [ -z "${tag}" ]; then + tag="${{ steps.semver.outputs.tag }}" + fi + echo "tag=${tag}" >> "$GITHUB_OUTPUT" + - name: Package + run: ./scripts/package.sh --version "${{ steps.tag.outputs.tag }}" + - name: Create Release Notes + id: create-release-notes + uses: paketo-buildpacks/github-config/actions/release/notes@main + with: + repo: ${{ github.repository }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + - name: Create Release + uses: paketo-buildpacks/github-config/actions/release/create@main + with: + repo: ${{ github.repository }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + tag_name: v${{ steps.tag.outputs.tag }} + target_commitish: ${{ github.sha }} + name: v${{ steps.tag.outputs.tag }} + body: ${{ steps.create-release-notes.outputs.release_body }} + draft: true + assets: | + [ + { + "path": "build/buildpack.tgz", + "name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz", + "content_type": "application/gzip" + }, + { + "path": "build/buildpackage.cnb", + "name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb", + "content_type": "application/gzip" + } + ] + + failure: + name: Alert on Failure + runs-on: ubuntu-22.04 + needs: [ unit, release ] + if: ${{ always() && needs.unit.result == 'failure' || needs.release.result == 'failure' }} + steps: + - name: File Failure Alert Issue + uses: paketo-buildpacks/github-config/actions/issue/file@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo: ${{ github.repository }} + label: "failure:release" + comment_if_exists: true + issue_title: "Failure: Create Draft Release workflow" + issue_body: | + Create Draft Release workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). + comment_body: | + Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/go-get-update.yml b/.github/workflows/go-get-update.yml new file mode 100644 index 0000000..f08b5fc --- /dev/null +++ b/.github/workflows/go-get-update.yml @@ -0,0 +1,52 @@ +name: Go Get Update + +on: + schedule: + - cron: '0 0 * * 1' # Once per week, Mondays at midnight + workflow_dispatch: {} + +jobs: + update: + name: Go Get Update + runs-on: ubuntu-22.04 + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + - name: Checkout + uses: actions/checkout@v3 + + - name: Checkout Branch + uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main + with: + branch: automation/tools/go-get-update + + - shell: bash + run: | + go get -u -t ./... + go mod tidy + + - name: Commit + id: commit + uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main + with: + message: "Running 'go get -u -t ./...'" + pathspec: "." + keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} + key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} + + - name: Push Branch + if: ${{ steps.commit.outputs.commit_sha != '' }} + uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main + with: + branch: automation/tools/go-get-update + + - name: Open Pull Request + if: ${{ steps.commit.outputs.commit_sha != '' }} + uses: paketo-buildpacks/github-config/actions/pull-request/open@main + with: + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + title: "Running 'go get -u -t ./...'" + branch: automation/tools/go-get-update diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml new file mode 100644 index 0000000..e8749d9 --- /dev/null +++ b/.github/workflows/label-pr.yml @@ -0,0 +1,33 @@ +name: Set / Validate PR Labels +on: + pull_request_target: + branches: + - main + types: + - synchronize + - opened + - reopened + - labeled + - unlabeled + +concurrency: pr_labels_${{ github.event.number }} + +jobs: + autolabel: + name: Ensure Minimal Semver Labels + runs-on: ubuntu-22.04 + steps: + - name: Check Minimal Semver Labels + uses: mheap/github-action-required-labels@v1 + with: + count: 1 + labels: semver:major, semver:minor, semver:patch + mode: exactly + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Auto-label Semver + if: ${{ failure() }} + uses: paketo-buildpacks/github-config/actions/pull-request/auto-semver-label@main + env: + GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/lint-yaml.yml b/.github/workflows/lint-yaml.yml new file mode 100644 index 0000000..145dfb9 --- /dev/null +++ b/.github/workflows/lint-yaml.yml @@ -0,0 +1,30 @@ +name: Lint Workflows + +on: + pull_request: + paths: + - '.github/**.yml' + - '.github/**.yaml' + +jobs: + lintYaml: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Checkout github-config + uses: actions/checkout@v3 + with: + repository: paketo-buildpacks/github-config + path: github-config + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: 3.8 + + - name: Install yamllint + run: pip install yamllint + + - name: Lint YAML files + run: yamllint ./.github -c github-config/.github/.yamllint diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..db52af7 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + golangci: + name: lint + runs-on: ubuntu-22.04 + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + - name: Checkout + uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.45.2 + args: --timeout 3m0s diff --git a/.github/workflows/push-buildpackage.yml b/.github/workflows/push-buildpackage.yml new file mode 100644 index 0000000..f96478e --- /dev/null +++ b/.github/workflows/push-buildpackage.yml @@ -0,0 +1,94 @@ +name: Push Buildpackage + +on: + release: + types: + - published + +jobs: + push: + name: Push + runs-on: ubuntu-22.04 + steps: + + - name: Parse Event + id: event + run: | + FULL_VERSION="$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" + MINOR_VERSION="$(echo "${FULL_VERSION}" | awk -F '.' '{print $1 "." $2 }')" + MAJOR_VERSION="$(echo "${FULL_VERSION}" | awk -F '.' '{print $1 }')" + echo "tag_full=${FULL_VERSION}" >> "$GITHUB_OUTPUT" + echo "tag_minor=${MINOR_VERSION}" >> "$GITHUB_OUTPUT" + echo "tag_major=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT" + echo "download_url=$(jq -r '.release.assets[] | select(.name | endswith(".cnb")) | .url' "${GITHUB_EVENT_PATH}")" >> "$GITHUB_OUTPUT" + + - name: Download + id: download + uses: paketo-buildpacks/github-config/actions/release/download-asset@main + with: + url: ${{ steps.event.outputs.download_url }} + output: "/github/workspace/buildpackage.cnb" + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + + - name: Validate version + run: | + buidpackTomlVersion=$(sudo skopeo inspect "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" | jq -r '.Labels."io.buildpacks.buildpackage.metadata" | fromjson | .version') + githubReleaseVersion="${{ steps.event.outputs.tag_full }}" + if [[ "$buidpackTomlVersion" != "$githubReleaseVersion" ]]; then + echo "Version in buildpack.toml ($buidpackTomlVersion) and github release ($githubReleaseVersion) are not identical" + exit 1 + fi + + - name: Push to GCR + env: + GCR_PUSH_BOT_JSON_KEY: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }} + run: | + echo "${GCR_PUSH_BOT_JSON_KEY}" | sudo skopeo login --username _json_key --password-stdin gcr.io + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_full }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_minor }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:${{ steps.event.outputs.tag_major }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest" + + - name: Push to DockerHub + id: push + env: + DOCKERHUB_USERNAME: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }} + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} + run: | + REPOSITORY="${GITHUB_REPOSITORY_OWNER/-/}/${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}" # translates 'paketo-buildpacks/bundle-install' to 'paketobuildpacks/bundle-install' + IMAGE="index.docker.io/${REPOSITORY}" + echo "${DOCKERHUB_PASSWORD}" | sudo skopeo login --username "${DOCKERHUB_USERNAME}" --password-stdin index.docker.io + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:${{ steps.event.outputs.tag_full }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:${{ steps.event.outputs.tag_minor }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:${{ steps.event.outputs.tag_major }}" + sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://${IMAGE}:latest" + echo "image=${IMAGE}" >> "$GITHUB_OUTPUT" + echo "digest=$(sudo skopeo inspect "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" | jq -r .Digest)" >> "$GITHUB_OUTPUT" + + - name: Register with CNB Registry + uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:main + with: + id: ${{ github.repository }} + version: ${{ steps.event.outputs.tag_full }} + address: ${{ steps.push.outputs.image }}@${{ steps.push.outputs.digest }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + + failure: + name: Alert on Failure + runs-on: ubuntu-22.04 + needs: [push] + if: ${{ always() && needs.push.result == 'failure' }} + steps: + - name: File Failure Alert Issue + uses: paketo-buildpacks/github-config/actions/issue/file@main + with: + token: ${{ secrets.GITHUB_TOKEN }} + repo: ${{ github.repository }} + label: "failure:push" + comment_if_exists: true + issue_title: "Failure: Push Buildpackage workflow" + issue_body: | + Push Buildpackage workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}). + comment_body: | + Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} diff --git a/.github/workflows/synchronize-labels.yml b/.github/workflows/synchronize-labels.yml new file mode 100644 index 0000000..3aaa017 --- /dev/null +++ b/.github/workflows/synchronize-labels.yml @@ -0,0 +1,18 @@ +name: Synchronize Labels +"on": + push: + branches: + - main + paths: + - .github/labels.yml + workflow_dispatch: {} +jobs: + synchronize: + name: Synchronize Labels + runs-on: + - ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - uses: micnncim/action-label-syncer@v1 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml new file mode 100644 index 0000000..a1faaa2 --- /dev/null +++ b/.github/workflows/test-pull-request.yml @@ -0,0 +1,39 @@ +name: Test Pull Request + +on: + pull_request: + branches: + - main + +concurrency: + # only one instance of test suite per PR at one time + group: pr-${{ github.event.number }} + cancel-in-progress: true + +jobs: + unit: + name: Unit Tests + runs-on: ubuntu-22.04 + outputs: + builders: ${{ steps.builders.outputs.builders }} + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.x + + - name: Checkout + uses: actions/checkout@v3 + + - name: Run Unit Tests + run: ./scripts/unit.sh + + upload: + name: Upload Workflow Event Payload + runs-on: ubuntu-22.04 + steps: + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: event-payload + path: ${{ github.event_path }} diff --git a/.github/workflows/update-github-config.yml b/.github/workflows/update-github-config.yml new file mode 100644 index 0000000..9fe88ac --- /dev/null +++ b/.github/workflows/update-github-config.yml @@ -0,0 +1,62 @@ +name: Update shared github-config + +on: + schedule: + - cron: '30 1 * * *' + workflow_dispatch: {} + +concurrency: github_config_update + +jobs: + build: + name: Create PR to update shared files + runs-on: ubuntu-22.04 + steps: + + - name: Checkout + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + + - name: Checkout github-config + uses: actions/checkout@v3 + with: + repository: paketo-buildpacks/github-config + path: github-config + + - name: Checkout Branch + uses: paketo-buildpacks/github-config/actions/pull-request/checkout-branch@main + with: + branch: automation/github-config/update + + - name: Run the sync action + uses: paketo-buildpacks/github-config/actions/sync@main + with: + workspace: /github/workspace + config: /github/workspace/github-config/implementation + + - name: Cleanup + run: rm -rf github-config + + - name: Commit + id: commit + uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main + with: + message: "Updating github-config" + pathspec: "." + keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }} + key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }} + + - name: Push Branch + if: ${{ steps.commit.outputs.commit_sha != '' }} + uses: paketo-buildpacks/github-config/actions/pull-request/push-branch@main + with: + branch: automation/github-config/update + + - name: Open Pull Request + if: ${{ steps.commit.outputs.commit_sha != '' }} + uses: paketo-buildpacks/github-config/actions/pull-request/open@main + with: + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + title: "Updates github-config" + branch: automation/github-config/update From dccffb1452debd311be6129d406dba6f3fa60502 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 31 Mar 2023 12:21:34 -0400 Subject: [PATCH 2/2] Update .github/workflows/update-github-config.yml Co-authored-by: Ryan Moran <155736+ryanmoran@users.noreply.github.com> --- .github/workflows/update-github-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-github-config.yml b/.github/workflows/update-github-config.yml index 9fe88ac..c4a5dfa 100644 --- a/.github/workflows/update-github-config.yml +++ b/.github/workflows/update-github-config.yml @@ -33,7 +33,7 @@ jobs: uses: paketo-buildpacks/github-config/actions/sync@main with: workspace: /github/workspace - config: /github/workspace/github-config/implementation + config: /github/workspace/github-config/library - name: Cleanup run: rm -rf github-config