-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Scheduled workflows * initial commit * Updates
- Loading branch information
Showing
2 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: |- | ||
Scheduled Context | ||
Scheduled update of context.tf and related docs | ||
### Usage | ||
```yaml | ||
name: scheduled-context | ||
on: | ||
workflow_call: | ||
permissions: | ||
pull-requests: write | ||
id-token: write | ||
contents: read | ||
jobs: | ||
scheduled-context: | ||
uses: cloudposse/github-actions-workflows/.github/workflows/scheduled-context.yml@main | ||
``` | ||
on: | ||
workflow_call: | ||
inputs: | ||
base-branch: | ||
description: "Repo default branch" | ||
type: string | ||
required: false | ||
default: 'main' | ||
runs-on: | ||
description: "Overrides job runs-on setting (json-encoded list)" | ||
type: string | ||
required: false | ||
default: '["ubuntu-latest"]' | ||
|
||
jobs: | ||
update: | ||
runs-on: ${{ fromJSON(inputs.runs-on) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Update context.tf | ||
shell: bash | ||
id: update | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
run: | | ||
if [[ -f context.tf ]]; then | ||
echo "Discovered existing context.tf! Fetching most recent version to see if there is an update." | ||
curl -o context.tf -fsSL https://raw.githubusercontent.com/cloudposse/terraform-null-label/master/exports/context.tf | ||
if git diff --no-patch --exit-code context.tf; then | ||
echo "No changes detected! Exiting the job..." | ||
else | ||
echo "context.tf file has changed. Update examples and rebuild README.md." | ||
make init | ||
make github/init/context.tf | ||
make readme/build | ||
echo "create_pull_request=true" >> $GITHUB_OUTPUT | ||
fi | ||
else | ||
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates." | ||
fi | ||
- name: Create Pull Request | ||
if: steps.update.outputs.create_pull_request == 'true' | ||
uses: cloudposse/actions/github/create-pull-request@0.33.0 | ||
with: | ||
commit-message: Update context.tf from origin source | ||
title: Update context.tf | ||
body: |- | ||
## what | ||
This is an auto-generated PR that updates the `context.tf` file to the latest version from `cloudposse/terraform-null-label` | ||
## why | ||
To support all the features of the `context` interface. | ||
branch: auto-update/context.tf | ||
base: ${{ inputs.base-branch }} | ||
delete-branch: true | ||
labels: | | ||
auto-update | ||
context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: |- | ||
Scheduled Readme | ||
Scheduled update of readme.md | ||
### Usage | ||
```yaml | ||
name: scheduled-readme | ||
on: | ||
workflow_call: | ||
permissions: | ||
pull-requests: write | ||
id-token: write | ||
contents: read | ||
jobs: | ||
scheduled-readme: | ||
uses: cloudposse/github-actions-workflows/.github/workflows/scheduled-readme.yml@main | ||
``` | ||
on: | ||
workflow_call: | ||
inputs: | ||
base-branch: | ||
description: "Repo default branch" | ||
type: string | ||
required: false | ||
default: 'main' | ||
runs-on: | ||
description: "Overrides job runs-on setting (json-encoded list)" | ||
type: string | ||
required: false | ||
default: '["ubuntu-latest"]' | ||
|
||
jobs: | ||
update: | ||
runs-on: ${{ fromJSON(inputs.runs-on) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Update readme | ||
shell: bash | ||
id: update | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
run: | | ||
make init | ||
make readme/build | ||
# Ignore changes if they are only whitespace | ||
if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then | ||
git restore README.md | ||
echo Ignoring whitespace-only changes in README | ||
fi | ||
- name: Create Pull Request | ||
uses: cloudposse/actions/github/create-pull-request@0.33.0 | ||
with: | ||
commit-message: Update README.md and docs | ||
title: Update README.md and docs | ||
body: |- | ||
## what | ||
This is an auto-generated PR that updates the README.md and docs | ||
## why | ||
To have most recent changes of README.md and doc from origin templates | ||
branch: auto-update/readme | ||
base: ${{ inputs.base-branch }} | ||
delete-branch: true | ||
labels: | | ||
auto-update | ||
no-release | ||
readme |