Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Mar 6, 2024
0 parents commit eb83c5d
Show file tree
Hide file tree
Showing 19 changed files with 2,858 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.php]
indent_size = 4

[*.yaml]
indent_size = 4
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PRODUCTIVE_ORG_ID=''
PRODUCTIVE_AUTH_TOKEN=''
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish

on:
push:
tags:
- '*.*.*'

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- run: composer install --no-dev --optimize-autoloader

- name: Build workflow
run: ./scripts/build.sh

- run: |
IS_PRERELEASE=false
if [[ $GITHUB_REF_NAME =~ 'alpha' || $GITHUB_REF_NAME =~ 'beta' || $GITHUB_REF_NAME =~ 'rc' ]]; then
IS_PRERELEASE=true
fi
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref }}
name: v${{ github.ref_name }}
body: Please refer to [CHANGELOG.md](https://github.com/studiometa/alfred-productive-workflow/blob/${{ github.ref_name }}/CHANGELOG.md) for details.
draft: false
prerelease: ${{ env.IS_PRERELEASE }}
artifacts: alfred-productive-workflow.alfredworkflow
57 changes: 57 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish

on:
push:
branches:
- develop
- main
pull_request:

jobs:
phpcs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- run: composer install

- run: composer run lint:style

phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'

- run: composer install

- run: composer run lint:static
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vendor/
/tmp/
/cache/
/prefs.plist
/.env
/*.alfredworkflow
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## v0.0.0 - 2024.03.06

First release 🎉
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Studio Meta <[email protected]> (https://www.studiometa.fr)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# alfred-productive-workflow

An [Alfred](https://alfred.app/) workflow to quickly interact with your [Productive.io](https://productive.io) organization.

## Installation

Download the workflow from the [latest release](https://github.com/studiometa/alfred-productive-workflow) and install it. You will be prompted to configure 2 variables:

- `PRODUCTIVE_ORG_ID`: the ID of your organization on Productive, you can find it in the URL when logging in `https://app.productive.io/<PRODUCTIVE_ORG_ID>-foo/...`
- `PRODUCTIVE_AUTH_TOKEN`: a personal access token for the API, generate one in Settings → API integrations

Once this is done, open Alfred and use the `pp` keyword to list all tasks from your organization.

### Troubleshooting

You may need to allow the execution of the static PHP CLI shipped with the Workflow. To do so, right click on the workflow in Aflred and choose "Open in Finder", then, if you are on a M1 or greater, right on the `bin/php-8.2.13-cli-macos-arm64` (otherwise use the one ending with `x86_64`) file and choose `Open with → Terminal`. You should be prompted by macOS to indicate if you trust this executable or not, choose as you prefer (if you refuse, the workflow will not work), then quit the Terminal app.

## Credits

Thanks to [crazywhalecc/static-php-cli](https://github.com/crazywhalecc/static-php-cli) for the static PHP executables and to [brandlabs/productiveio](https://github.com/brandlabs/productiveio) for the [Productive.io](https://productive.io) SDK
18 changes: 18 additions & 0 deletions bin/php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

cd "$(dirname "$0")/.."

ARCH=$(uname -m)
PHP_CLI="$(pwd)/bin/php-8.2.13-cli-macos-${ARCH}"

if [[ ! -f "$PHP_CLI" ]]
then
echo "Could not find a PHP static CLI for the ${ARCH} architecture."
exit 1
fi

$PHP_CLI "$@"
Binary file added bin/php-8.2.13-cli-macos-arm64
Binary file not shown.
Binary file added bin/php-8.2.13-cli-macos-x86_64
Binary file not shown.
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"require": {
"php": "^8.2",
"brandlabs/productiveio": "^0.1.1",
"illuminate/collections": "^10.47",
"symfony/cache": "^7.0",
"vlucas/phpdotenv": "^5.6"
},
"config": {
"allow-plugins": {
"php-http/discovery": true
},
"sort-packages": true
},
"require-dev": {
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.9"
},
"scripts": {
"lint": [
"@lint:style",
"@lint:static"
],
"lint:style": "phpcs",
"lint:static": "phpstan analyze",
"fix": [
"@fix:style"
],
"fix:style": "phpcbf"
}
}
Loading

0 comments on commit eb83c5d

Please sign in to comment.