Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make bot name/email configurable #40

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions get-screenshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:

| Key | Description | Required | Default |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | :------: | :---------------------------- |
| `bot-email` | The email address of the bot account used to commit screenshots. | N | `[email protected]` |
| `bot-name` | The name of the bot account used to commit screenshots.. | N | `Snapcrafters Bot` |
| `issue-number` | The issue number to post the screenshots to. | Y | |
| `ci-repo` | The repo to fetch tools/templates from. Only for debugging. | N | `snapcrafters/ci` |
| `channel` | The channel to create the call for testing for. | N | `latest/candidate` |
Expand Down
14 changes: 11 additions & 3 deletions get-screenshots/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ branding:
color: orange

inputs:
bot-email:
description: "The email address of the bot account used to commit screenshots."
required: false
default: "[email protected]"
bot-name:
description: "The name of the bot account used to commit screenshots."
required: false
default: "Snapcrafters Bot"
issue-number:
description: "The issue number to post the screenshots into"
required: true
Expand Down Expand Up @@ -126,11 +134,11 @@ runs:
cp -L "$HOME/ghvmctl-screenshots/screenshot-screen.png" "${file_prefix}-screen.png"
cp -L "$HOME/ghvmctl-screenshots/screenshot-window.png" "${file_prefix}-window.png"

git config --global user.email "merlijn.sebrechts+snapcrafters-bot@gmail.com"
git config --global user.name "Snapcrafters Bot"
git config --global user.email "${{ inputs.bot-email }}"
git config --global user.name "${{ inputs.bot-name }}"

git add -A .
git commit -m "data: screenshots for snapcrafters/${snap_name}#${{ inputs.issue-number }}"
git commit -m "data: screenshots for ${github.repository_owner}/${snap_name}#${{ inputs.issue-number }}"
git push origin main

echo "screen=https://raw.githubusercontent.com/${{ inputs.screenshots-repo }}/main/${file_prefix}-screen.png" >> "$GITHUB_OUTPUT"
Expand Down
20 changes: 11 additions & 9 deletions release-to-candidate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ jobs:

### Inputs

| Key | Description | Required | Default |
| ------------------------ | ----------------------------------------------------------------------------------------- | :------: | :----------------- |
| `architecture` | The architecture for which to build the snap. | N | `amd64` |
| `channel` | The channel to release the snap to. | N | `latest/candidate` |
| `launchpad-token` | A token with permissions to create Launchpad remote builds. | Y | |
| `multi-snap` | Whether the repo contains the source for multiple snaps. | N | `false` |
| Key | Description | Required | Default |
| ------------------------ | ----------------------------------------------------------------------------------------- | :------: | :------------------------- |
| `architecture` | The architecture for which to build the snap. | N | `amd64` |
| `bot-email` | The email address of the bot account used to commit screenshots. | N | `[email protected]` |
| `bot-name` | The name of the bot account used to commit screenshots.. | N | `Snapcrafters Bot` |
| `channel` | The channel to release the snap to. | N | `latest/candidate` |
| `launchpad-token` | A token with permissions to create Launchpad remote builds. | Y | |
| `multi-snap` | Whether the repo contains the source for multiple snaps. | N | `false` |
| `repo-token` | A token with privileges to create and push tags to the repository. | Y |
| `snapcraft-project-root` | The path to the Snapcraft YAML file. | N | |
| `snapcraft-channel` | The channel to install Snapcraft from. | N | `latest/stable` |
| `store-token` | A token with permissions to upload and release to the specified channel in the Snap Store | Y | |
| `snapcraft-project-root` | The path to the Snapcraft YAML file. | N | |
| `snapcraft-channel` | The channel to install Snapcraft from. | N | `latest/stable` |
| `store-token` | A token with permissions to upload and release to the specified channel in the Snap Store | Y | |

### Outputs

Expand Down
20 changes: 14 additions & 6 deletions release-to-candidate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ inputs:
description: "The architecture to build the snap for"
default: amd64
required: false
bot-email:
description: "The email address of the bot account used to commit screenshots."
required: false
default: "[email protected]"
bot-name:
description: "The name of the bot account used to commit screenshots."
required: false
default: "Snapcrafters Bot"
channel:
description: "The channel to publish the snap to"
default: "latest/candidate"
Expand Down Expand Up @@ -70,8 +78,8 @@ runs:
echo "new-remote-build=true" >> "$GITHUB_OUTPUT"
fi

git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git config --global user.email "${{ inputs.bot-email }}"
git config --global user.name "${{ inputs.bot-name }}"

- name: Setup Launchpad credentials
shell: bash
Expand All @@ -83,8 +91,8 @@ runs:
echo "${{ inputs.launchpad-token }}" > ~/.local/share/snapcraft/provider/launchpad/credentials
echo "${{ inputs.launchpad-token }}" > ~/.local/share/snapcraft/launchpad-credentials

git config --global user.email "[email protected]"
git config --global user.name "Github Actions"
git config --global user.email "${{ inputs.bot-email }}"
git config --global user.name "${{ inputs.bot-name }}"

- name: Find and parse snapcraft.yaml
id: snapcraft-yaml
Expand Down Expand Up @@ -176,8 +184,8 @@ runs:
name: ${{ steps.snapcraft-yaml.outputs.snap-name }}
version: ${{ steps.snapcraft-yaml.outputs.version }}
run: |
git config --global user.name 'Snapcrafters Bot'
git config --global user.email 'merlijn.sebrechts+snapcrafters-bot@gmail.com'
git config --global user.name "${{ inputs.bot-name }}"
git config --global user.email "${{ inputs.bot-email }}"

revision="${{ steps.publish.outputs.revision }}"

Expand Down
14 changes: 8 additions & 6 deletions sync-version/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ jobs:

### Inputs

| Key | Description | Required | Default |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | -------- | :---------: |
| `branch` | The branch on which modifications to snapcraft.yaml should be made. | N | `candidate` |
| `snapcraft-project-root` | The root of the snapcraft project, where the `snapcraft` command would usually be executed from. Do not include the trailing `/`. | N | |
| `token` | A token with permissions to commit to the repository. | Y | |
| `update-script` | A script that checks for version updates and updates `snapcraft.yaml` and other files if required. | Y | |
| Key | Description | Required | Default |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------- | -------- | :------------------------: |
| `bot-email` | The email address of the bot account used to commit screenshots. | N | `[email protected]` |
| `bot-name` | The name of the bot account used to commit screenshots.. | N | `Snapcrafters Bot` |
| `branch` | The branch on which modifications to snapcraft.yaml should be made. | N | `candidate` |
| `snapcraft-project-root` | The root of the snapcraft project, where the `snapcraft` command would usually be executed from. Do not include the trailing `/`. | N | |
| `token` | A token with permissions to commit to the repository. | Y | |
| `update-script` | A script that checks for version updates and updates `snapcraft.yaml` and other files if required. | Y | |

### Outputs

Expand Down
12 changes: 10 additions & 2 deletions sync-version/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ branding:
color: orange

inputs:
bot-email:
description: "The email address of the bot account used to commit screenshots."
required: false
default: "[email protected]"
bot-name:
description: "The name of the bot account used to commit screenshots."
required: false
default: "Snapcrafters Bot"
branch:
description: "The branch on which modifications to snapcraft.yaml should be made."
default: "candidate"
Expand Down Expand Up @@ -60,8 +68,8 @@ runs:
if [[ ! "$old_version" == "$new_version" ]]; then
version=$new_version
fi
git config --global user.name 'Snapcrafters Bot'
git config --global user.email 'merlijn.sebrechts+snapcrafters-bot@gmail.com'
git config --global user.name "${{ inputs.bot-name }}"
git config --global user.email "${{ inputs.bot-email }}"
if [[ -n "${version:-}" ]]; then
git commit -am "chore: bump ${snap_name} to version ${version}"
else
Expand Down